Using function parameters to determine method kind
Michele Simionato
michele.simionato at poste.it
Mon Apr 5 08:17:39 EDT 2004
Lenard Lindstrom <len-1 at telus.net> wrote in message news:<4qrzym6e.fsf at telus.net>...
> I was wondering if anyone has suggested having Python determine
> a method's kind from its first parameter. 'self' is a de facto
> reserved word; 'cls' is a good indicator of a class method
> ( __new__ is a special case ).
I find relaying on tbe parameter name to specify the kind of method
to be rather fragile. It works most times but not always. What about
inner classes for instance? Also, there are situations where you want
a method to work both with instances and classes, so do you want to
use self or cls?
I support PEP 318 also because this will kill home grown hacks (including
my own) to provide this kind of functionality.
I am also waiting for a better "super" but it seems nobody is talking
about it.
Michele Simionato
More information about the Python-list
mailing list