Is it advisable to replace 'self' with '_' or 'I' or something shorter?
Carl Banks
imbosol at vt.edu
Sat Jan 11 14:13:24 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?
This must be self-loathing week. If you're going to do that, I
recommend that you not use the underscore. The underscore has come to
be used for internationalization (with good reason, I would say). If
you use the underscore, you're now violating two community standards.
'I' is probably the best one character self; at least it's somewhat
descriptive and reminiscent of 'self'.
I think it's most wise not to deviate from self, though.
--
CARL BANKS
More information about the Python-list
mailing list