[Python-ideas] Multi-line comment blocks.
Guido van Rossum
guido at python.org
Fri Jun 15 18:43:35 CEST 2012
Let's not try to design a syntax for multi-line comments. There are
already enough ways to emulate them. Designing a new syntax based on #
plus some special character is doomed for backwards compatibility
(never mind the clever tricks proposed).
On Fri, Jun 15, 2012 at 9:23 AM, David Gates <gatesda at gmail.com> wrote:
> 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:
>> Well fancy that.
>> Robert Kern
>> "I have come to believe that the whole world is an enigma, a harmless
>> that is made terrible by our own mad attempt to interpret it as though it
>> an underlying truth."
>> -- Umberto Eco
>> Python-ideas mailing list
>> Python-ideas at python.org
> Python-ideas mailing list
> Python-ideas at python.org
--Guido van Rossum (python.org/~guido)
More information about the Python-ideas