Is it advisable to replace 'self' with '_' or 'I' or something shorter?

Grant Edwards grante at
Sat Jan 11 19:43:09 CET 2003

In article <ThZT9.98$B62.32373 at>, Kevin Altis wrote:

> The most common is probably 's'. However, it makes it more difficult for
> other people to read your source if don't use 'self', so it isn't advisable.
> You might consider binding a "macro" to type out "self." if typing the
> characters bothers you

I don't know about the OP, but I don't care about the typing.  That's NRE.
It's the reading that's a problem.  If you've expressions like

they end up looking like


I have a much easier time grokking the former.  In some cases you end up
with lines 100+ characters long instead of 20 or 30.

Using local variables helps...

Grant Edwards                   grante             Yow!  I want to kill
                                  at               everyone here with a cute
                                 colorful Hydrogen Bomb!!

More information about the Python-list mailing list