<div dir="ltr">My editor, Xemacs, also highlights the word "self." I personally find that a bit annoying, and perhaps that is part of the reason I don't appreciate the word. When I write an algorithm, I don't want to see some artifact highlighted, as if it is somehow the most important part of the algorithm. I like seeing keywords highlighted, but I don't want to see "self" highlighted because it is only a convention. Maybe I'm alone on that.<br>
<br>As I wrote earlier, I copied one of my larger Python files and replaced each occurrence of "self" with "S". That was approximately 350 occurrences. I also replaced each occurrence of "cls" with "C", which was another 50 or so occurrences. The file size was reduced by 2.8%, many wrapped lines no longer need to wrap, and I like the way it looks.<br>
<br>I understand that people like to have "one true way," but I think Python programmers are adaptable enough to handle this one. When you read code, you certainly need to read the argument names anyway, so the fact that "S" is being used instead of "self" should be obvious. The only minor disadvantage I can think of is that searching on a single character can be problematic, but if you are using an IDE, that should not be an issue (and I can't remember ever searching on "self" anyway).<br>
<br>One of these days, when I get a chance, I may write an informational PEP recommending the use of "S" as an acceptable replacement for "self", and "C" as an accptable replacement for "cls". I hope that doesn't blow any fuses.<br>
<br>Have a nice day.<br><br>--Russ<br><br><div class="gmail_quote">On Mon, Aug 25, 2008 at 11:58 PM, Torsten Bronger <span dir="ltr"><<a href="mailto:bronger@physik.rwth-aachen.de">bronger@physik.rwth-aachen.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hallöchen!<br>
<div class="Ih2E3d"><br>
Russ Paielli writes:<br>
<br>
> Just for fun, I made a copy of one of my Python files with<br>
> hundreds of occurrences of "self", and I replaced them all with<br>
> "S". This streamlines things significantly, and I think it looks<br>
> good, but I suppose most Python aficionados would be aghast. I'm<br>
> thinking about doing it permanently for all my files. I normally<br>
> avoid single-character names, but I think this case could be a<br>
> reasonable exception. What would you think if you saw this in<br>
> "production" code?<br>
<br>
</div>The "self" convention goes so far that my editor highlights it --<br>
this may be true for other editors/HTML highlighters, too.  I'd even<br>
frown upon any programmer who breaks this convention for code that<br>
has the slightest chance to become public.<br>
<br>
Besides, I don't consider "self"s cluttering up the code.  YMMV, but<br>
I don't measure code legibility by the terseness of certain<br>
identifies at all.<br>
<br>
Tschö,<br>
Torsten.<br>
<font color="#888888"><br>
--<br>
Torsten Bronger, aquisgrana, europa vetus<br>
                   Jabber ID: <a href="mailto:torsten.bronger@jabber.rwth-aachen.de">torsten.bronger@jabber.rwth-aachen.de</a><br>
</font><div><div></div><div class="Wj3C7c"><br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><a href="http://RussP.us">http://RussP.us</a><br>
</div>