Proposal for removing self

Jacek Generowicz jacek.generowicz at cern.ch
Thu Aug 26 17:01:34 CEST 2004


"Brent W. Hughes" <brent.hughes at comcast.net> writes:

> When doing object-oriented stuff, it bothers me to have to type "self" so
> many times.

When doing object-oriented stuff, it makes me extactic to write
"self." in front of instance attributes. The knowledge that other
programmers are always doing the same, makes me even more happy.

The fact that there are plenty of C++ and Java coding conventions
which require that all class members' names start with "m_", or that
all instance attributes be accessed, in methods, via "this->" or
"this."  (depending) on the language in question, seems to support
Python's choice in this matter.

> I propose that Python allow the programmer to optionally type
> ".variable" instead of "self.variable" to mean the same thing.  Of course,
> the interpreter would have to be more careful about detecting floats that
> begin with just a period as in ".5".  What are your thoughts?

I think you should get into the habit of reading FAQs, Archives,
Googling (you know, the usual stuff), before making such suggestions
publically.



More information about the Python-list mailing list