__init__() not called automatically
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Thu May 26 16:38:12 EDT 2005
Roy Smith a écrit :
> bruno modulix <onurb at xiludom.gro> wrote:
>
>>I've always explicitelly used the (implied) 'this' pseudo-pointer in
>>Java, C++ etc. The wart is in all those languages that don't makes it
>>mandatory IMHO !-)
>
>
> And the correlary wart in Python is that the first argument to a
> method is not required to be called "self".
Well, I would not call this a wart. Because when it's a class method,
naming the fisrt param 'cls' could seem more appropriate !-)
> The vast majority of
> people use "self", but every once in a great while you run into some
> yahoo who feels this is the right place to express his creativity and
> call it "this", or "obj", or some other obfuscation.
Then every python programmer in its own mind will throw away this code
with mimics of disgust, and everything is fine.
More seriously, I prefer to have some bozo using this instead of self -
which I can easily correct if needed - than having to deal with implicit
this in a whole code base...
More information about the Python-list
mailing list