I have been using Cython for some time to develop the PyAMF c-extensions and have found it to be an awesome project! Recently, I discovered Python type declarations e.g.:
def object foo():
cdef dict x = {}
x['foo'] = 'bar'
return x['foo']
The current PyAMF code is littered with PyDict_* calls so I am in the process
of refactoring it to make use of this syntactic sugar.
When I generate the C code (using Cython 0.12.1) for the above function, the
resulting C code will use PyDict_SetItem for the assignment statement but will
use PyObject_GetItem on line 6. I have attached a snippet of the generated C
[pyobject_getitem.c].
Would it make more sense to use PyDict_SetItem in this case? I have included a
patch for this case [getitem.diff] if its useful. I haven't developed a test
for this change, some pointers as to the correct location would be useful if
that is desirable.
Cython makes it possible for me to build c based extensions really quickly and
the speedups have been dramatic! Thanks again!
Nick
pyobject_getitem.c
Description: Binary data
getitem.diff
Description: Binary data
_______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
