This question already has an answer here:
- Why doesn't Python have multiline comments? 16 answers
Is there a mechanism to comment out large blocks of Python code?
Right now, the only ways I can see of commenting out code are to either start every line with a #
, or to enclose the code in triple quotes: """
.
The problem with these is that inserting #
before every line is cumbersome and """
makes the string I want to use as a comment show up in generated documentation.
After reading all comments, the answer seems to be "No".
I use Notepad++ on a Windows machine, select your code, type
CTRL-K
. To uncomment you select code and press Ctrl + Shift + K.Incidentally, Notepad++ works nicely as a Python editor. With auto-completion, code folding, syntax highlighting, and much more. And it's free as in speech and as in beer!