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

Torsten Bronger bronger at physik.rwth-aachen.de
Tue Aug 26 08:58:16 CEST 2008


Russ Paielli writes:

> Just for fun, I made a copy of one of my Python files with
> hundreds of occurrences of "self", and I replaced them all with
> "S". This streamlines things significantly, and I think it looks
> good, but I suppose most Python aficionados would be aghast. I'm
> thinking about doing it permanently for all my files. I normally
> avoid single-character names, but I think this case could be a
> reasonable exception. What would you think if you saw this in
> "production" code?

The "self" convention goes so far that my editor highlights it --
this may be true for other editors/HTML highlighters, too.  I'd even
frown upon any programmer who breaks this convention for code that
has the slightest chance to become public.

Besides, I don't consider "self"s cluttering up the code.  YMMV, but
I don't measure code legibility by the terseness of certain
identifies at all.


Torsten Bronger, aquisgrana, europa vetus
                   Jabber ID: torsten.bronger at jabber.rwth-aachen.de

More information about the Python-ideas mailing list