Another Language Change for Debate

James_Althoff at i2.com James_Althoff at i2.com
Sat Jan 12 02:12:57 CET 2002


Alex Martelli wrote:
>Playing devil's advocate:
>
>class sic(object):
>    def sic.aclassmethod(): pass
>    def self.anormalmethod(): pass
>
>Isn't this better than the current
>
>class sic(object):
>    def aclassmethod(klass): pass
>    aclassmethod = classmethod(aclassmethod)
>    def anormalmethod(self): pass

I can see some appeal.  But since we need the 1st param in class methods it
probably should be (given that Guido seems to prefer "cls" for the
equivalent of "self" in class methods):

class sic(object):
    def cls.aclassmethod(): pass
    def self.anormalmethod(): pass

And since Python would then have to know about "cls" and "self", why not
add "static":

class sic(object):
    def cls.aclassmethod(): pass
    def self.anormalmethod(): pass
    def static.astaticmethod(): pass

The meaning of "static.xxx():" is slightly different in that there is no
1st param named "static", but maybe that's not such a big concern.

In this scenario, if one wanted to use 1st param names other than "self"
and "cls", just revert to the current (more awkward mechanisms).

Jim





More information about the Python-list mailing list