Another Language Change for Debate

Matt donut at SaPzAsMtarnet.com
Fri Jan 11 18:04:42 EST 2002


In article <f3baf765.0201111354.70032ecb at posting.google.com>, IB wrote:
> Hello, Michael:
> 
> My 2 cents are that we have to ask one more question - what other
> benefits would there be if such syntax would be allowed?
> 
> I would agree that it would be a neat thing, but after few minutes of
> thinking on the subject I could not come up with anything extra...

Actually, I thought up one neat thing after reading it... 

> Michael Chermside <mcherm at destiny.com> wrote in message news:<mailman.1010773286.16324.python-list at python.org>...
>> So here's my idea. Allow the following syntax:
>> 
>> class MyClass(OtherClass):
>>     def self.addItems( newItems ):
>>        self.items += newItems

After using some staticmethod() (in python2.2), it popped out at
me how support for staticmethod/classmethod could be added without
new keywords:

class MyClass:
    def self.foo(x):
        #instance method
    def bar(y):
        #staticmethod
    def class.baz(z):
        #classmethod

(Of course, since this would break ALL old code, adding new
keywords would be probably be a better idea. ;)

-- 
Matthew Mueller
Noone likes spam in their email.



More information about the Python-list mailing list