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

jerf at jerf at
Tue Jan 14 01:24:43 CET 2003

On Mon, 13 Jan 2003 10:52:24 -0500, Mel Wilson wrote:
>    As a tiny addition: I seem to find it more useful to
> rebind entire variables, so that I write
>     t = self.tree
>     t.yadayada()
>     t.usw ()
> rather than
>     s = self
>     s.tree.yadayada()
>     s.tree.usw ()

This hews close to one of my pet peeves, which I see a *lot* of in Windows
C++ code, anything that looks like this:


For the love of pete, rebind a few things so it looks more sensible. (The
compiler has to anyhow in compiled languages like C++...)

In particular, take the opportunity to do something meaningful if
possible. Maybe "this->frame.lexFromMextex" is really the
"billingFrameIterator" or something. (You'd probably abbreviate Iterator
to It, but still...)

More information about the Python-list mailing list