Class methods on user types

Heiko Wundram heikowu at ceosg.de
Fri Jun 4 05:36:52 EDT 2004


Hi all!

I've written a user type, and I've declared class methods on it. Now... 
Strange things are'a happening, and the class methods which are declared on 
the type get the following output from pydoc:

     |  bin = <built-in method bin of type object>
	<actual doc>
     |  fac = <built-in method fac of type object>
	<actual doc>
etc...

The methods are declared in the PyMethodDef array of the class with the 
following syntax:

{"bin", (PyCFunction)GMPi_bin,
METH_CLASS | METH_VARARGS | METH_KEYWORDS,
GMPi_bin_doc},

{"fac", (PyCFunction)GMPi_fac,
METH_CLASS | METH_VARARGS | METH_KEYWORDS,
GMPi_fac_doc},

etc.

If I've understood the documentation correctly, this should create the 
appropriate class methods on the type. But why are they being attributed to 
type? Is it something I've done wrong in the declaration, or is this just the 
way it works?

Any info appreciated!

puzzeldly-y'rs,

Heiko.




More information about the Python-list mailing list