Perl is worse!

Grant Edwards nobody at nowhere.nohow
Fri Jul 28 21:22:29 EDT 2000


In article <slrn8o3f73.49c.grey at teleute.rpglink.com>, Steve Lamb wrote:
>On 28 Jul 2000 12:49:57 -0400, Eric Lorenzo <zo at angband.org> wrote:

>>But communication with the *computer* isn't actually the primary
>>purpose of typing.  Rather, typing is a means for programmers to
>
> Funny, I thought that was what comments were for.

Comments are in theory good things.  

In practice they're usually bad because they're generally wrong.

> Given the choice, I'd rather have comments, not cues in the code.  :)

You must have been given code to maintain that was in a much different state
than most of that upon which I've worked.  Even if only 10% of the comments
are wrong, you don't know _which_ 10% are wrong, so you've to figure out
what the code does anyway.  If I can tell what a line of code does, I delete
the comment.  If I can't tell what a line of code does, I figure out what it
does, re-write it to make it more obvious, and delete the coment.

The only comments I've ever found to be useful are the general descriptions
of what a function is supposed to do.  Comments along the lines of

"This function appends files (given pathnames) to a MIME e-mail"

"This function sends a MIME e-mail to an SMTP server"

Comments documenting individual lines of code are in my experience wrong
often enough that they are useless.  The possible exception to this is in
_very_ carefully maintained assembly language programs where there is simply
no way to make the purpose of a line of code obvious without a comment.

-- 
Grant Edwards                   grante             Yow!  Was my SOY LOAF left
                                  at               out in th'RAIN? It tastes
                               visi.com            REAL GOOD!!



More information about the Python-list mailing list