[Cython] Virtual cpdef methods

Jeroen Demeyer jdemeyer at cage.ugent.be
Tue Jun 21 02:17:55 EDT 2016


On 2016-06-20 17:31, Robert Bradshaw wrote:
> All methods (cdef, cpdef, and def) are virtual by default in Cython,
> just like Python.

I meant "pure virtual" or "abstract": just declared but without an 
implementation.

> Sounds like you want a cdef function to me.  You can override a cdef
> function with a cpdef function for any subclass that wishing to expose
> it to Python.

I was totally not aware that you could override cdef with cpdef.

But hang on, are you sure that this works? The C functions for cdef and 
cpdef functions have a different signature: cpdef functions have a 
__pyx_skip_dispatch argument while cdef functions don't have such an 
argument.


More information about the cython-devel mailing list