[Python-ideas] Multi-line comment blocks.

Carl Meyer carl at oddbird.net
Sat Jun 16 01:07:55 CEST 2012

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


More information about the Python-ideas mailing list