Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81148

Re: Most gratuitous comments

Newsgroups comp.lang.python
Date 2014-11-20 15:59 -0800
References <546d7505$0$12899$c3e8da3$5496439d@news.astraweb.com> <b7dff0ad-9654-416b-9e99-6341aff2b872@googlegroups.com> <b932kb-isj.ln1@chris.zbmc.eu> <25fa214f-2060-46a8-bebf-d191d69e9a9c@googlegroups.com> <546e7644$0$13014$c3e8da3$5496439d@news.astraweb.com>
Message-ID <6ab51e97-19c5-4008-a755-c55eb71469ba@googlegroups.com> (permalink)
Subject Re: Most gratuitous comments
From sohcahtoa82@gmail.com

Show all headers | View raw


On Thursday, November 20, 2014 3:16:33 PM UTC-8, Steven D'Aprano wrote:
> sohcahtoa82@gmail.com wrote:
> 
> > On Thursday, November 20, 2014 1:33:16 PM UTC-8, c...@isbd.net wrote:
> >> s...@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.

My point was that I was making fun of CS professors that demand a comment on every line of code, regardless of how clear the line of code is.  The fact that I happened to use 'x' as a variable name was inconsequential, and I felt that Chris's criticism of using a single-letter variable name was pedantic because it missed the point entirely and picked on something else that wasn't an issue.

I was trying to illustrate the point that some professors would demand you write code like this...

# increment the line count
lineCount += 1

# Check if line count is over 10
if lineCount > 10
    # Tell the user there are too many lines
    print 'There are too many lines!

...which is obviously bad commenting style.  But I guess my original minimal example was too minimal.


> 
> (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

I use Google Groups which seems to be pretty unpopular on this list.  Does it break thread organization?  Or is it really just a politeness thing?

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Most gratuitous comments Steven D'Aprano <steve@pearwood.info> - 2014-11-20 04:58 +0000
  Re: Most gratuitous comments Chris Angelico <rosuav@gmail.com> - 2014-11-20 16:06 +1100
  Re: Most gratuitous comments Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-11-20 12:04 +0000
  Re: Most gratuitous comments sohcahtoa82@gmail.com - 2014-11-20 10:52 -0800
    Re: Most gratuitous comments cl@isbd.net - 2014-11-20 21:32 +0000
      Re: Most gratuitous comments sohcahtoa82@gmail.com - 2014-11-20 13:43 -0800
        Re: Most gratuitous comments Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-21 10:16 +1100
          Re: Most gratuitous comments sohcahtoa82@gmail.com - 2014-11-20 15:59 -0800
            Re: Most gratuitous comments Chris Angelico <rosuav@gmail.com> - 2014-11-21 11:17 +1100
              Re: Most gratuitous comments sohcahtoa82@gmail.com - 2014-11-20 16:19 -0800
                Re: Most gratuitous comments Chris Angelico <rosuav@gmail.com> - 2014-11-21 11:33 +1100
            Re: Most gratuitous comments Marko Rauhamaa <marko@pacujo.net> - 2014-11-21 08:52 +0200
              Re: Most gratuitous comments Grant Edwards <invalid@invalid.invalid> - 2014-11-21 17:04 +0000
              Re: Most gratuitous comments Marco Buttu <marco.buttu@gmail.com> - 2014-11-25 13:40 +0100
                Re: Most gratuitous comments Marko Rauhamaa <marko@pacujo.net> - 2014-11-25 14:53 +0200
                Re: Most gratuitous comments Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-26 01:47 +1100
      Re: Most gratuitous comments Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-11-20 23:18 +0000
    Re: Most gratuitous comments Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-20 21:39 -0500
  Re: Most gratuitous comments Stefan Behnel <stefan_ml@behnel.de> - 2014-11-20 20:09 +0100
  Re: Most gratuitous comments albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-12-04 09:48 +0000
    Re: Most gratuitous comments Rob Gaddi <rgaddi@technologyhighland.invalid> - 2014-12-04 09:12 -0800
  Re: Most gratuitous comments sjmsoft@gmail.com - 2014-12-04 07:08 -0800

csiph-web