Too many 'self' in python.That's a big flaw in this language.
aleax at mac.com
Thu Jun 28 08:01:59 CEST 2007
Bjoern Schliessmann <usenet-mail-0306.20.chr0n0ss at spamgourmet.com>
> Mh, strange, I personally like to use "this.a" in C++, to make clear
> I use an instance variable.
That would be nice, unfortunately your C++ compiler will refuse that,
and force you to use this->a instead;-).
Many programming shops use naming conventions instead, such as my_a or
a_ (trailing underscore for member-variables) -- I've even seen the
convention this_a which IMHO is silly (at that point you might as well
use this->a and avoid the 'convention'!-).
Anyway, I essentially agree with you (except for the C++ bit: since this
is a pointer, it needs ->). However, full disclosure, Smalltalk/XP
superstar Kent Beck disagrees -- in his good book "Test Driven Design by
Example", in the chapter where he gives the Python example, he DOES
whine against the need to explicitly say self (the one bad bit in the
For the curious: the explicit-self idea is essentially taken from
Modula-3, a sadly now forgotten language which still had an impact on
the history of programming.
More information about the Python-list