multiline comments

James Stroud jstroud at ucla.edu
Wed Apr 19 00:33:46 EDT 2006


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/



More information about the Python-list mailing list