Perl is worse!

Bill de hÓra bill at dehora.fsnet.co.uk
Sat Jul 29 15:09:00 EDT 2000


>     Funny, I thought that was what comments were for.
>
> match = re.match(r'(\d+)')
> foo = int(match.group(1))
>
> vs.
>
> m/(\d+)/;
> foo = $1; # should be a number
>
>     Given the choice, I'd rather have comments, not cues in the code.  :)

Comments are a last resort, with the exception of API level documentation a
lá Javadoc. Though God knows the JDK could do with explaining *how to* and
*how long*.

Comments fall out of line with code over time. That is simply a fact of
software development. A lot of big software is commented by people other
than those who developed it; usually long after is has been developed. I
know of programmers who will remove all comments in code they have
inherited, and then get to the code. What it does *now* is more important
than what someone *thought* it *used* to do.

It's my hope that future languages will not allow in-code comments, the same
way Python has dumped bracketing. Instead replace comments with naming,
abstraction and unit tests. Comments are a story about code; too often that
story is fairy tale.

If you can't clarify your code without inline comments, you're not done.

-Bill de hÓra







More information about the Python-list mailing list