[Python-ideas] Multi-line comment blocks. (original) (raw)

Guido van Rossum guido at python.org
Sat Jun 16 01:47:59 CEST 2012


On Fri, Jun 15, 2012 at 4:07 PM, Carl Meyer <carl at oddbird.net> wrote:

On 06/15/2012 04:51 PM, Guido van Rossum wrote:

On Fri, Jun 15, 2012 at 3:47 PM, David Gates <gatesda at gmail.com> wrote:

My proposal wasn't for people who hand-code the single-line comment syntax but for those that use multi-line string comments.  Since the multi-line string hack's BDFL-approved, people will use it and other people will have to deal with it.

What's wrong with it? The reason I discourage using multi-line strings as comments is that they don't nest (which I think David mentioned earlier). If you've got a short multi-line-string-as-comment in the middle of a function, and then you try to use multi-line-string technique to comment out that entire function, you don't get what you want, you get a syntax error as your short comment is now parsed as code. (FWIW, I don't think this means Python needs a dedicated syntax for multi-line comments, I think multiple lines beginning with # works just fine.)

In which languages do multi-line comments nest? AFAIK not in the Java/C/C++/JavaScript family.

-- --Guido van Rossum (python.org/~guido)



More information about the Python-ideas mailing list