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

Erik Max Francis max at alcyone.com
Sun Jan 12 01:02:43 EST 2003


"Jonathan P." wrote:

> I agree with the fact that explicit use of self is good
> for code readability, however it tends to make code lines
> too long.  Since 'self' is just a convention, I wonder if
> people out there have tried replacing it with a one-character
> equivalent without encountering any problems.
> 
> I was thinking of using '_' ('I' is a distant second
> choice) instead of self.  Comments?

I would consider any systematic use of a self parameter named something
other than `self' a near perversity.  You're just begging for confusion.

If you want to rebind it in the method, fine.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Life is not a spectacle or a feast; it is a predicament.
\__/ George Santayana
    CSBuddy / http://www.alcyone.com/pyos/csbuddy/
 A Counter-Strike server log file monitor in Python.




More information about the Python-list mailing list