[Python-ideas] Multi-line comment blocks.

David Gates gatesda at gmail.com
Sat Jun 16 00:47:12 CEST 2012

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.

The best alternative would be official discouragement of multi-line string
comments.  It's fine if Python doesn't have an officially-sanctioned
multi-line comment syntax, but if it's going to have one, it should have
one that makes sense.

On Fri, Jun 15, 2012 at 4:12 PM, Steven D'Aprano <steve at pearwood.info>wrote:

> David Gates wrote:
>> Multi-line strings as comments don't nest, don't play well with
>> docstrings,
>> and are counter-intuitive when there's special language support for
>> single-line comments. Python should only have one obvious way to do
>> things,
> That's not what the Zen says. The zen says:
> There should be one-- and preferably only one --obvious way to do it.
> which is a positive statement that there should be an obvious way to solve
> problems, NOT a negative statement that there shouldn't be non-obvious ways.
>  and Python has two ways to comment, only one of which is obvious. My
>> suggestion is to add language support for comment blocks, using Python's
>> existing comment delimiter:
> There is already support for nested multi-line comments: the humble #
> symbol can be nested arbitrarily deep. All you need is a modern editor that
> understands Python syntax, and with a single command you can comment or
> uncomment a block:
> # This is a commented line.
> # def fun(a, b, c):
> #     """Docstrings are fine when commented"""
> #     pass
> #     # This is a nested comment.
> # And no need for an end-delimiter either.
> If your editor is old or too basic, you can do it by hand, which is a
> pain, but doable.
> Python doesn't need dedicated syntax to make up for the limitations of
> your editor. Don't complicate the language for the sake of those poor fools
> stuck using Notepad.
> --
> Steven
> _______________________________________________
> 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/b26c0d89/attachment.html>

More information about the Python-ideas mailing list