[Python-ideas] Multi-line comment blocks.

David Gates gatesda at gmail.com
Fri Jun 15 18:23:39 CEST 2012

I agree that using multi-line strings as literals comes across as an ugly
hack, even if it is BDFL-approved.

Your other point is valid, though as far as I can tell it's only an issue
when the comment is indented less than it ought to be (and starts with "#:",
of course):

#: Valid either way. The next line has the
#: same level of indentation, so it's not
#: counted as part of the block.

# Causes an IndentationError in existing code.

def foo():
#: This one would break.

On Fri, Jun 15, 2012 at 8:04 AM, Robert Kern <robert.kern at gmail.com> wrote:

> On 6/15/12 11:49 AM, Sven Marnach wrote:
>> Robert Kern schrieb am Fri, 15. Jun 2012, um 10:50:40 +0100:
>>> Multi-line string literals aren't comments. They are multi-line
>>> string literals. Unlike a comment, which does not show up in the
>>> compiled bytecode, the Python interpreter actually does something
>>> with those string literals. Sometimes people abuse them as ways to
>>> poorly emulate block comments, but this is an abuse, not a feature
>>> of the language.
>> Multi-line string literals do not generate code in CPython, and their
>> use as comments has BDFL approval:
>>     https://twitter.com/gvanrossum/status/112670605505077248
> Well fancy that.
> --
> Robert Kern
> "I have come to believe that the whole world is an enigma, a harmless
> enigma
>  that is made terrible by our own mad attempt to interpret it as though it
> had
>  an underlying truth."
>  -- Umberto Eco
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120615/7af238aa/attachment.html>

More information about the Python-ideas mailing list