python improvements (Was: Re: New Language)

Martijn Faassen m.faassen at vet.uu.nl
Mon May 15 16:40:37 EDT 2000


Russell E. Owen <owen at astronojnk.washington.edu.invalid> wrote:
[snip]
> - class methods (e.g. ClassName.doSomething(...)). Often useful where 
> global functions might otherwise be wanted. By requiring the class name 
> one gets namespace protection and categorizes the function as relevant 
> to objects of the given class.

Hm, how would this provide you with more namespace protection than the
current module system? By being in the same module, a function also
gets categorized as relevant to objects of the classes defined in the
module, too..

> - class methods don't need "self" as the first argument; it's a keyword 
> that is autmomatically defined. Less confusing because the caller's 
> argument list matches the receiver's argument list. Also, by forcing a 
> keyword ("self") to be used, improves code uniformity.

Hm, but this would destroy the nice smooth transition from records to
objects in Python:

class Record:
    pass

def method(self):
    self.foo = 1

class Class:
    def method(self):
        self.foo = 1

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list