[Pyrex] Re: cdef class and classmethod

Greg Ewing greg at cosc.canterbury.ac.nz
Mon Sep 20 05:18:38 CEST 2004


Martin Field <mjfield at ibs.fr>:

> I've tried to define a classmethod for a Pyrex extension type
> (i.e. "cdef class") but it does not seem to work.

You can't do that, at least not in the obvious way. You might be able
to slip it into the class's __dict__ after creation (i.e. using code
outside the class body), but you'll probably have to use
PyDict_SetItem, since the __dict__ of a type object is protected
against modification by normal means.

> If not, will this facility be made available in future releases of
> Pyrex?

I haven't been planning to. I'll add it to the list of requested
features, but I can't promise anything.

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