Cython interface with other extensions
Is it possible to use both Cython and pure python extensions together? Say I'd like to have a wrappe开发者_JAVA百科r for a C function, returning GdkPixbuf pointer. The ultimate goal would be to have that function available in python, returning gtk.gdk.Pixbuf object.
Yes it is possible because most of the things that can be done with python can also be done in cython. However, using python extensions or doing anything with python objects (as opposed to statically declared C datatypes) will incur a performance penalty, so Cython will be less of an advantage.
Look into cdef classes, they are an efficient way to implement objects in cython.
精彩评论