0

是否可以同时使用 Cython 和纯 python 扩展?假设我想要一个 C 函数的包装器,返回 GdkPixbuf 指针。最终目标是让该函数在 python 中可用,返回 gtk.gdk.Pixbuf 对象。

4

1 回答 1

0

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.

于 2011-03-29T02:12:04.197 回答