Re: __init__() not called automatically
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: __init__() not called automatically

From: Bruno Desthuilliers <bdesth.quelquechose@free.quelquepart.fr>
Date: Thu May 26 2005 - 22:38:12 CEST

Roy Smith a écrit :
> bruno modulix <onurb@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...
Received on Thu Sep 29 16:14:33 2005