Your code should be self-documenting. Comments should be for describing why you are doing something. If you feel you need a comment to explain what you are doing, the code could probably be rewritten more clearly.
Use PEP8 style. Not only is this style good for readability, but consistent styling helps us all better understand each other’s code.
Use builtin plugins of your IDE or the
pep8command line tool to validate your code style.
Docstrings are required for all modules, classes, attributes, methods and functions. Docstrings should follow the Google Python Style Guide for consistency.