Most gratuitous comments

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Nov 21 00:16:20 CET 2014


sohcahtoa82 at gmail.com wrote:

> On Thursday, November 20, 2014 1:33:16 PM UTC-8, c... at isbd.net wrote:
>> s... at gmail.com wrote:
>> > 
>> > # increment x
>> > x += 1
>> 
>> But it shouldn't say 'increment x', it should say 'add one to the line
>> count' or some such.  Although changing the variable name to
>> 'lineCount' would do almost as well.
> 
> This is the kind of pedantic crap I was referring to in another thread.
> 
> Of course I wouldn't call a variable 'x' unless it was representing an x
> coordinate in 2D or 3D space.


I think you may have missed the point of Chris' post. In context, the use
of "x" as a variable might be meaningful, but "x" can also be an archetypal
bad variable name. Chris' point is that choosing a meaningful name can be
self-documenting and so reduces the need for comments.


(By the way, whatever tool you are using to post comments is badly breaking
attributions. It is polite to give the person's full name when quoting
them, when they provide one, if not give their full email address.
Truncating their email address to a single letter before the "@" has no
useful purpose and breaks attribution.)



-- 
Steven




More information about the Python-list mailing list