Zen of Python

Also known as PEP 20, the guiding principles for Python’s design.

  1. >>> import this
  2. The Zen of Python, by Tim Peters
  3.  
  4. Beautiful is better than ugly.
  5. Explicit is better than implicit.
  6. Simple is better than complex.
  7. Complex is better than complicated.
  8. Flat is better than nested.
  9. Sparse is better than dense.
  10. Readability counts.
  11. Special cases aren't special enough to break the rules.
  12. Although practicality beats purity.
  13. Errors should never pass silently.
  14. Unless explicitly silenced.
  15. In the face of ambiguity, refuse the temptation to guess.
  16. There should be one-- and preferably only one --obvious way to do it.
  17. Although that way may not be obvious at first unless you're Dutch.
  18. Now is better than never.
  19. Although never is often better than *right* now.
  20. If the implementation is hard to explain, it's a bad idea.
  21. If the implementation is easy to explain, it may be a good idea.
  22. Namespaces are one honking great idea -- let's do more of those!

For some examples of good Python style, see these slides from a Python usergroup.