Comments within a line
Heike C. Zimmerer
usenet04q1 at hczim.de
Sat Jul 31 10:23:45 CEST 2004
"Edward Diener" <eldiener at earthlink.net> writes:
> Has there ever been any discussion of adding comments notation to Python,
> such as C++'s /* */, which could occur in the middle of a line or span
> multiple lines ? I would like to see it as a more elegant solution for
> quickly commenting out code.
In C/C++, you wouldn't use /* */ for commenting out code, since it
would collide with any comment already there (comments can't be
nested). Instead, the usual way is using #if 0 ... #endif.
You can use "if 0:" with python as well, but of course, you'd have to
indent the entire commented-out block. With most editors, this isn't
much of a problem. I usually use some smaller, "odd" indent than
usual to have an indicication later where the block ends.
More information about the Python-list