total idiot question: +=, .=, etc...

Alan Gauld alan.gauld at gssec.bt.co.uk
Thu Jun 24 08:50:01 EDT 1999


Reimer Behrends wrote:
> _am_ getting pretty sick of having to type self.whatever countless
> times, where pretty much any other language allows me to discard the
> "self." part. Not only is it annoying to type, it also reduces the
> readability of OO code a lot, much like the gratuitious use of
> punctuation characters as variable prefixes in Perl does.

I used to think that, but after some time in python land I 
just finished reviewing the code of a C++ project (about 
5,000 new lines, 7 new classes in a system with 200,000 
lines and about 200 classes.).

I was amazed to discover how difficult it was to understand 
the code because I couldn't identify which variables were 
local to the function, which were instance variables and 
which were global.

This gets worse when dealing with multiple inheritance, 
I wound up spend significant time in the headers directory 
doing grep... The self notation makes it clear and pretty 
unambiguous.

Alan G.

-- 
=================================================
This post represents the views of the author 
and does not necessarily accurately represent 
the views of BT.




More information about the Python-list mailing list