why no block comments in Python?

Terry Hancock hancock at anansispaceworks.com
Wed Mar 8 20:19:42 EST 2006


On Wednesday 08 March 2006 12:42 pm, Warby wrote:
> The danger with block comments is that there is no way to tell that the
> code you're looking at has been commented out unless you can see the
> start or end of the comment block.  If you have a modern editor, it
> probably changes the color of all commented out code to eliminate
> confusion.  But if you have a primitive editor it does not.  Also, even
> people who use modern editors sometimes browse source code using a
> plain text viewer (less/more).

No doubt some Emacs zealot will say something snarky at this point, ;-)
but it's also true that Vi (or gvim anyway) will occasionally get
confused by very long block comments or triple-quoted strings,
causing the syntax-color to get out of synch.

I recently started running into this problem when I started using
doctest tests.  There's probably a smarter way to do this, but I
was putting several of them in a module docstring, and it gets to
be a 100+ lines or so of doctest plus explanations.

I'm thinking this might be a use-case for the new support for
doctests in a separate file.  Or maybe I just need to see if I
can move the tests into individual object docstrings.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com



More information about the Python-list mailing list