Coding Style: Readability Counts
Programs must be written for people to read, and only incidentally for machinesto execute.—Abelson & Sussman,
Structureand Interpretation of Computer Programs
Try to make your programs easy to read and obvious.
PEP 8: Style Guide for Python Code
PEP = Python Enhancement ProposalA PEP is a design document providing information to the Python community, ordescribing a new feature for Python or its processes or environment.The Python community has its own standards for what source code should look like,codified in PEP 8. These standards are different from those of other communities, like C,C++, C#, Java, VisualBasic, etc.Because indentation and whitespace are so important in Python, the Style Guide forPython Code approaches a standard. It would be wise to adhere to the guide! Most open-source projects and (hopefully) in-house projects follow the style guide quite closely.
4 spaces per indentation level.
No hard tabs.
mix tabs and spaces.
Page 3 of 36Code Like a Pythonista: Idiomatic Python (Crunchy Remix)3/23/2008http://www.omahapython.org/IdiomaticPython.html