Comments

We believe docstrings are the right place for most documentation in Python code. They explain how to consume the facilities your module provides rather than how it works. Ideally your code should be clean enough that ancillary explanation is not required. Nevertheless, it's sometimes necessary to explain why a particular approach has be chosen or a particular technique used, and we can do that using Python comments. Comments in Python begin with # and continue to the end of the line.

As a demonstration, let's document the fact that it might not be immediately obvious why we're using sys.argv[1] rather than sys.argv[0] in our call to main():

if __name__ == '__main__':
main(sys.argv[1]) # The 0th arg is the module filename.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset