[Python-ideas] PEP: Shorthand Symbol for "self"

Aahz aahz at pythoncraft.com
Mon Aug 25 02:02:29 CEST 2008

On Sun, Aug 24, 2008, Russ Paielli wrote:
> Abstract
>     In Python, the class instance for which a method is called is
>     referred to within the method by the first formal argument.  By
>     convention, that first argument is typically named "self".
>     Attributes of "self" are referred to using the standard "dot"
>     notation, as in "self.attr".  As a result, complex methods can
>     become cluttered with many occurrences of "self.".  This PEP
>     proposes to allow the dollar symbol, "$", to be used as a
>     shorthand symbol for "self." or, in general, for "<arg1>.", where
>     "<arg1>" is the name of the first argument.  Thus, "self.attr"
>     could be written more succinctly as "$attr".  

<sniff><sniff>  Smells like Perl.  -1

(Sorry, but that *will* be the automatic reaction from many people, and
because your proposal doesn't deal with the issue up-front, it has no
chance to fly.)
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Adopt A Process -- stop killing all your children!

More information about the Python-ideas mailing list