111 Python does have a multiline string/comment syntax in the sense that unless used as docstrings, multiline strings generate no bytecode -- just like # -prepended comments. In effect, it acts exactly like a comment.
What is the most Pythonic way of putting blank lines between comments and the actual code? I want to show my program to some experts. And want my code to look more professional.
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: """.
Instead of indivually typing out a hash tag in front of each line, is there a way to select a block of code and comment/uncomment everything by only pressing a couple shortcut keys?
For python code, the "comment block" command Alt + Shift + A actually wraps the selected text in a multiline string, whereas Ctrl + / is the way to toggle any type of comment (including a "block" comment as asked here).
Most Python IDEs let you select-and-comment a block at a time, this is how many people handle that situation. Then there are normal single-line python strings: They can use ' or " quotation marks (eg 'foo' "bar").
Python does have a multiline string/comment syntax in the sense that unless used as docstrings, multiline strings generate no bytecode -- just like #-prepended comments.
Python way is with # on every line if you want to comments something or for inline comments everything after # is ignored. If you really want to comment a multiline statement that is really necessary put it before or after it.
To clarify: my question is about when to use comments instead of docstrings. Python is opinionated and seems to want to docstrings for most (all?) code description purposes. That being true, are there any circumstances where Python conventions favor comments over docstrings?