Too many 'self' in python.That's a big flaw in this language.

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at
Wed Jun 27 17:29:40 CEST 2007

hide1713 at wrote:

> I'm currently using Python. 

How long have you been using Python?

> I find that a instance variable 
> must confined with self, for example:
> class a:
>     def __init__(self):
>         self.aa=10
>     def bb(self):
>         print self.aa # 
> See .if in c++,I could use aa to change that variable

Mh, strange, I personally like to use "this.a" in C++, to make clear
I use an instance variable.

> That's a big inconvenience in coding ,especially when you have lot
> of variable

NACK, see above.

> If you method need 10 variables ,you have to type "self" for 10 
> times and that also makes your variable longer.

Explicit is better than implicit.
> From My point,I think this only help python interpreter to deside
> where to look for.

IMHO, it's also a great hint for the programmer. With others' C++
code, I'm often confused what kinds of variables (global, instance,
static, ...) they access, it's also badly commented. If C++ forced
the programmer to write "this.var", the code would be
understandable with much less comments.



BOFH excuse #13:

we're waiting for [the phone company] to fix that line

More information about the Python-list mailing list