[Python-Dev] METH_CLASS
Thomas Heller
thomas.heller@ion-tof.com
2002年4月25日 16:14:01 +0200
> > The devel-docs tell me about METH_CLASS:
> >
> > The method will be passed the type object as the first parameter
> > rather than an instance of the type. This is used to create class
> > methods, similar to what is created when using the classmethod()
> > built-in function. New in version 2.3.
> >
> > 1. This seems wrong. The first parameter the function receives
> > is NULL, the type object goes together with the remaining arguments
> > in the second parameter (which is a tuple).
> >
> > Is the documentation wrong, or is the code wrong (I didn't find
> > any use of METH_CLASS in the CVS sources)?
>> I'll leave this for Fred to answer, since he implemented this.
If there is still a choice, I would prefer that the docs are correct,
and the code should be fixed.
This would allow to use, for example, METH_O in the usual way:
a function which receives one parameter (in addition to the type
object passed implicitely).
Thomas