Python 3K or Python 2.9?

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Thu Sep 13 13:52:47 EDT 2007


TheFlyingDutchman a écrit :
> Well I'm with Bruce Eckel - there shouldn't be any argument for the
> object in the class method parameter list.

def fun(obj, *args, **kw):
   # generic code here that do something with obj

import some_module
some_module.SomeClass.fun = fun

This is why uniformity is important.

But anyway, I think it's quite clear that Python won't drop the explicit 
self, so it looks like you have to live with it or choose another language.

> Bruce said that no other mainstream OO language is explicitly passing
> the object as a parameter to class methods.

to methods. class methods gets the class as first parameter.

Anyway, there are a lot of things that Python doesn't do like "other 
mainstream OO languages", and that's a GoodThing.


> What I would like to have seen added to class definitions was the
> forced declaration of all object variables in the class outside of
> methods. I don't like the fact that they have to be, and can be
> created in any method on the fly.

I definitively think you'd be happier with some other language.



More information about the Python-list mailing list