Does Python have Class methods (yes, with this patch)

Pete Shinners shredwheat at mediaone.net
Tue May 8 11:40:39 EDT 2001


<costas at meezon.com> wrote
> Does Python support the concept of class methods (as opposed to
> instance methods)? If not is there a suggested way of doing this?

no, it doesn't. while there is support for class member data,
no support for class member functions. it's pretty inconsistent,
and there have been times i really wanted it.

in fact, i wrote a patch for it. it was trivial to implement,
i'm not so sure it will be accepted. but hey, show me the code, eh?

http://sourceforge.net/tracker/index.php?func=detail&aid=418390&group_id=5470&atid=305470

it works perfectly. class methods are just functions which don't
take a "self" argument. i've tried it for several cases and they
do work. just can't really base any code off of this until it
is accepted into python 2.2   ;]







More information about the Python-list mailing list