[Pyrex] #if

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Oct 22 07:32:46 CEST 2003


Bryan Weingarten <bryan.weingarten at pobox.com>:

> i am getting a bunch of __pyx_L? unreferenced label warnings.   i take 
> it i shouldn't be worried about these.

You can ignore them. (It's unfortunate that distutils cranks the
warning level of the C compiler up so high by default.)

> will they be cleaned up in future versions of pyrex?

Possibly, but don't hold your breath -- there are many other things
with higher priority I want to do first.  I'd rather find some way to
persuade distutils to tone down the warning level.

> i don't know when to use a  "class" and when to use a "cdef class" .  i 
> know the former creates a python class and other one creates an 
> extension type.  but what criteria should i consider to use each one.   

If you want it to have C attributes, it has to be an extension type
("cdef class"). Making something an extension type also makes it harder
for Python code to mess with its internals, and some things are
more efficient, e.g. special methods such as __add__, etc. are
invoked more directly.

> i didn't change a line of code in my test program, but i was able to 
> successfully excercise mpgedit_play  as a class and as as cdef class. 

I don't see how that could have worked, since Python classes
can't have C attributes. The code I posted could only work
with an extension type.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list