print(__doc__) in Python 3 script

it seems __doc__ is useful to provide some documentation in, say, functions This is true. In addition to functions, documentation can also be provided in modules. So, if you have a file named mymodule.py like this: You can access its docstrings like this: Now, back to your question: what does print(__doc__) do? Simply put: it prints the module docstring. If no … Read more

How to comment out a block of code in Python [duplicate]

Python does not have such a mechanism. Prepend a # to each line to block comment. For more information see PEP 8. Most Python IDEs support a mechanism to do the block-commenting-with-pound-signs automatically for you. For example, in IDLE on my machine, it’s Alt+3 and Alt+4. Don’t use triple-quotes; as you discovered, this is for documentation strings not block comments, although it … Read more