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

Jonathan P. jbperez808 at yahoo.com
Mon Jan 13 11:25:32 CET 2003


jbperez808 at yahoo.com (Jonathan P.) wrote in message news:<f57664b9.0301110959.5b1439da at posting.google.com>...
> 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?

One compromise I can think of would be to just use 'self'
all the time and in the isolated cases where it would 
lead to unbearably long (and unreadable) lines, create an
alias variable for the offending attribute.




More information about the Python-list mailing list