Getting rid of "self."

Terry Reedy tjreedy at
Sat Jan 8 05:39:41 EST 2005

"BJörn Lindqvist" <bjourne at> wrote in message 
news:740c3aec05010705393048a374 at
>I think it would be cool if you could refer to instance variables
>without prefixing with "self."

Others have expressed such a wish -- this comes up perhaps once a year. 
The bottom line is that as long as Python has separate instance and local 
namespaces with possibly duplicate names, then there must be a way to tell 
which namespace a name should be looked up in.  The current system is 
completely consistent with Python's object.attribute system.  It would be 
odd if instance attributes were referred to differently in module level 
code and function level code.

Terry J. Reedy

More information about the Python-list mailing list