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


Groups > comp.lang.python > #81052 > unrolled thread

Most gratuitous comments

Started bySteven D'Aprano <steve@pearwood.info>
First post2014-11-20 04:58 +0000
Last post2014-12-04 07:08 -0800
Articles 2 on this page of 22 — 14 participants

Back to article view | Back to comp.lang.python


Contents

  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

Page 2 of 2 — ← Prev page 1 [2]


#81922

FromRob Gaddi <rgaddi@technologyhighland.invalid>
Date2014-12-04 09:12 -0800
Message-ID<20141204091241.1f6bf93c@rg.highlandtechnology.com>
In reply to#81886
On 04 Dec 2014 09:48:49 GMT
albert@spenarnc.xs4all.nl (Albert van der Horst) wrote:

> In article <546d7505$0$12899$c3e8da3$5496439d@news.astraweb.com>,
> Steven D'Aprano  <steve@pearwood.info> wrote:
> >And the award for the most gratuitous comments before an import goes to
> >one of my (former) workmates, who wrote this piece of code:
> >
> ># Used for base64-decoding.
> >import base64
> ># Used for ungzipping.
> >import gzip
> 
> The comment lines contain genuine information. The program is
> decoding or gunzipping. (And apparently not doing the encoding part)
> 
> This information may have been better conveyed by
> "
> from base64 import base64-decode
> from gzip import gunzip
> "
> but anyway.
> 
> Also the comment may be misleading, but I think not.
> 
> If there are mysterious names for packages, the comment may be
> actually useful.
> "
> # Auxiliary for the reverse recursion to calculate
> # Chebychev coefficients.
> import courseware-2014-ch11
> "
> 
> A professor who demands from students that every import is documented
> is IMO not to blame.
> In a company's coding convention ... I've seen a lot of things there
> that make a lot less sense.
> 
> >--
> >Steven
> -- 
> Albert van der Horst, UTRECHT,THE NETHERLANDS
> Economic growth -- being exponential -- ultimately falters.
> albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
> 

In my code, I habitually use big old bar comments to break the imports
into three sections, standard library, third-party libraries, and local
imports.  I find it radically simplifies knowing where to start looking
for documentation.

-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.

[toc] | [prev] | [next] | [standalone]


#81909

Fromsjmsoft@gmail.com
Date2014-12-04 07:08 -0800
Message-ID<c8dc649d-5b1c-4655-ac7b-70e6a6074b57@googlegroups.com>
In reply to#81052
Many years ago I, too, had a couple of CS profs who forced us to include too many (usually innocuous) comments in our Fortran and PL/1 code.  Perhaps they were trying to counter the natural programmer tendency of not commenting at all?

Forty years of programming later (yikes!), I try to use comments to tell WHY I'm doing what I'm doing, especially when it's not obvious to someone else (or to me in about two weeks).  I never use comments to teach the reader what the Python language or libraries do.

Cheers,
  Steve J. Martin

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.python


csiph-web