From: Edward Elliott on
At the risk of flogging a dead horse, I'm wondering why Python doesn't have
any multiline comments. One can abuse triple-quotes for that purpose, but
that's obviously not what it's for and doesn't nest properly. ML has a
very elegant system for nested comments with (* and *).

Using an editor to throw #s in front of every line has limitations. Your
editor has to support it and you have to know how to use that feature. Not
exactly intuitive or easy for novices to pick up. Also a pain if your
preferred editor is python/perl/sh-agnostic.

Saying coders shouldn't use multiline comments to disable code misses the
point. Coders will comment out code regardless of the existence of
multiline comemnts. There has to be a better argument for leaving them out.

Keeping the language small and simple is desirable, but it's not an
absolute. A little syntactic sugar like 'for x in s' makes code easier to
read than 'for i in len(s): x = s[i]'. So what are the tradeoffs involved
with nested multiline comments? I'd like to understand the reasoning
behind keeping them out.
From: James Stroud on
Edward Elliott wrote:
> At the risk of flogging a dead horse, I'm wondering why Python doesn't
> have any multiline comments. One can abuse triple-quotes for that
> purpose, but that's obviously not what it's for and doesn't nest
> properly. ML has a very elegant system for nested comments with (* and *).
>
> Using an editor to throw #s in front of every line has limitations.
> Your editor has to support it and you have to know how to use that
> feature. Not exactly intuitive or easy for novices to pick up. Also a
> pain if your preferred editor is python/perl/sh-agnostic.
>
> Saying coders shouldn't use multiline comments to disable code misses
> the point. Coders will comment out code regardless of the existence of
> multiline comemnts. There has to be a better argument for leaving them
> out.
>
> Keeping the language small and simple is desirable, but it's not an
> absolute. A little syntactic sugar like 'for x in s' makes code easier
> to read than 'for i in len(s): x = s[i]'. So what are the tradeoffs
> involved with nested multiline comments? I'd like to understand the
> reasoning behind keeping them out.

I think the absence of multiline comments is like the requirement for
indentation. It enforces good habits. Better is to make your multiple
lines a function and comment out the function call.

James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
From: Ben Finney on
James Stroud <jstroud(a)ucla.edu> writes:

> Edward Elliott wrote:
> > At the risk of flogging a dead horse, I'm wondering why Python
> > doesn't have any multiline comments. [...]
> >
> > Using an editor to throw #s in front of every line has
> > limitations. Your editor has to support it and you have to know
> > how to use that feature. Not exactly intuitive or easy for
> > novices to pick up. Also a pain if your preferred editor is
> > python/perl/sh-agnostic.
>
> I think the absence of multiline comments is like the requirement
> for indentation. It enforces good habits. Better is to make your
> multiple lines a function and comment out the function call.

And/or switch to an editor that can perform editing operations on a
range of lines.

--
\ Q: "I've heard that Linux causes cancer..." Torvalds: "That's |
`\ a filthy lie. Besides, it was only in rats and has not been |
_o__) reproduced in humans." -- Linus Torvalds |
Ben Finney

From: Atanas Banov on

Edward Elliott wrote:
> At the risk of flogging a dead horse, I'm wondering why Python doesn't have
> any multiline comments. One can abuse triple-quotes for that purpose, but
> that's obviously not what it's for and doesn't nest properly.
....
> Saying coders shouldn't use multiline comments to disable code misses the
> point. Coders will comment out code regardless of the existence of
> multiline comemnts. There has to be a better argument for leaving them out.

i beg to differ: you'd be surprised how much effect can little
inconveniences have.

want to comment block of code? use tripple-quotes. does not nest? ahhh,
maybe it's time to get rid of that block you commented out a month ago
"just in case the new code doesnt work".

that gives you incentive to tidy up. don't be a code slob... don't
leave a mess forever ;-)

From: Ben Finney on
"Atanas Banov" <enterr(a)gmail.com> writes:

> Edward Elliott wrote:
> > Saying coders shouldn't use multiline comments to disable code
> > misses the point. Coders will comment out code regardless of the
> > existence of multiline comemnts. There has to be a better
> > argument for leaving them out.
>
> i beg to differ: you'd be surprised how much effect can little
> inconveniences have.
>
> want to comment block of code? use tripple-quotes. does not nest?
> ahhh, maybe it's time to get rid of that block you commented out a
> month ago "just in case the new code doesnt work".

Indeed. Using revision control means never needing to comment out
blocks of code.

If your revision control system is so inconvenient to use that you'd
rather have large blocks of commented-out code, it's time to start
using a better RCS -- perhaps a distributed one, so you can commit to
your own local repository with abandon while trying out changes.

--
\ "I saw a sign: 'Rest Area 25 Miles'. That's pretty big. Some |
`\ people must be really tired." -- Steven Wright |
_o__) |
Ben Finney