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

Lee Harr missive at frontiernet.net
Mon Jan 13 18:33:44 EST 2003


>>If you want to rebind it in the method, fine.
> 
>    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 ()
> 

Exactly. I believe it can also be faster.
Might be important in a tight loop.





More information about the Python-list mailing list