Re: A case for "real" multiline comments

2012-04-19 Thread Chris Angelico
On Thu, Apr 19, 2012 at 10:15 PM, Devin Jeanpierre wrote: > Why don't you allow nested multiline comments? Many languages (e.g. > ML, Scheme, Haskell, etc.) allow you to nest multi-line comments. It's > mostly the C family of languages that refuse to do this, AFAIK. Allowing nesting or not allowi

Re: A case for "real" multiline comments

2012-04-19 Thread Devin Jeanpierre
On Thu, Apr 19, 2012 at 2:56 AM, Chris Angelico wrote: > So, here's a proposal. (Maybe I should take this part to another list > or the Python issue tracker.) Introduce a new keyword or reuse > existing keywords to form a marker that unambiguously says "Ignore > these lines" and then subsequently

Re: A case for "real" multiline comments

2012-04-19 Thread Chris Angelico
On Thu, Apr 19, 2012 at 8:17 PM, Alek Storm wrote: >> comment def >> ... parser completely ignores these lines ... >> comment break > > > I believe the more Pythonic syntax would be: > > comment: >     ...some >     ...indented >     ...lines > > God help us if that ever happens. Certainly not. T

Re: A case for "real" multiline comments

2012-04-19 Thread Jean-Michel Pichavant
Chris Angelico wrote: [snip] Since Python doesn't have multiline comments, triple-quoted strings are sometimes pressed into service. [snip] Chris Angelico Let the triple quotes where they're meant to be. Use your text editor, any decent one will allow you to comment uncomment a block of cod

Re: A case for "real" multiline comments

2012-04-19 Thread Alek Storm
I think docstrings should look like strings, because they're essentially data: they end up as the __doc__ attribute of whatever class or function they're documenting. Conversely, they shouldn't be used as multi-line comments that aren't data (in the middle of functions) - the parser should disallow

Re: A case for "real" multiline comments

2012-04-18 Thread Chris Angelico
On Thu, Apr 19, 2012 at 4:04 PM, Cameron Simpson wrote: > Bah! To get into a function's docstring they need to be parsed by the > Python compiler. Ergo, not comments. > > Calling them comments in disguise is a bit of a stretch. They're fundamentally the same thing as Doxygen/Javadoc/etc comments.

Re: A case for "real" multiline comments

2012-04-18 Thread Cameron Simpson
On 19Apr2012 15:13, Chris Angelico wrote: | On Thu, Apr 19, 2012 at 2:29 PM, Cameron Simpson wrote: | > On 18Apr2012 22:07, Jordan Perr wrote: | > | I came across this case while debugging some Python code that contained an | > | error stemming from the use of multiline strings as comments. The

Re: A case for "real" multiline comments

2012-04-18 Thread Chris Angelico
On Thu, Apr 19, 2012 at 2:29 PM, Cameron Simpson wrote: > On 18Apr2012 22:07, Jordan Perr wrote: > | I came across this case while debugging some Python code that contained an > | error stemming from the use of multiline strings as comments. The code > | contained a very long list of objects, and

Re: A case for "real" multiline comments

2012-04-18 Thread Devin Jeanpierre
On Thu, Apr 19, 2012 at 12:29 AM, Cameron Simpson wrote: > I'd just do this: > >  list = [ >  Object1(arg), >  ## Object2(arg), >  ## Object3(arg), >  Object4(arg) >  ] > > Multiple lines of single line comments. Frankly, I find this much easier > to see (all the disabled lines are delineated with

Re: A case for "real" multiline comments

2012-04-18 Thread Cameron Simpson
On 18Apr2012 22:07, Jordan Perr wrote: | I came across this case while debugging some Python code that contained an | error stemming from the use of multiline strings as comments. The code | contained a very long list of objects, and I had commented out some of the | objects using the multiline st

A case for "real" multiline comments

2012-04-18 Thread Jordan Perr
I came across this case while debugging some Python code that contained an error stemming from the use of multiline strings as comments. The code contained a very long list of objects, and I had commented out some of the objects using the multiline string. This caused a string to be appended to the