[Pyrex] A couple of questions about pyrex
    Greg Ewing 
    greg.ewing at canterbury.ac.nz
       
    Wed May 13 02:24:28 CEST 2009
    
    
  
Yingjie Lan wrote:
> Then can we
> say that we make this distinction between 'cdef class' and 
> 'class' by checking if the class body contains any 
> statement treated as native?
No, that's not sufficient. Pyrex treats special
methods (__add__ etc.) very differently in extension
types. In a Python class, they're just ordinary
Python methods. In an extension class, they're
C functions that are plugged directly into the
relevant slots of the type object, and they
have different signatures.
And before you ask, no, we couldn't use 'cdef __add__',
because that already means something else (it
defines a C method, which is like a virtual method
in C++).
-- 
Greg
    
    
More information about the Pyrex
mailing list