The Zen of Python
1 2 3 4 5 6 7 8 9 10 11 | Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. |
Packages
1 2 3 4 5 6 | package/
__init__.py
module1.py
subpackage/
__init__.py
module2.py
|
1 2 3 | import package.module1 from packages.subpackage import module2 from packages.subpackage.module2 import name |
References
https://www.python.org/dev/peps/pep-0008/
“Python Objects”, Fredrik Lundh, http://www.effbot.org/zone/python-objects.htm
“How to think like a Pythonista”, Mark Hammond, http://python.net/crew/mwh/hacks/objectthink.html
“Python main() functions”, Guido van Rossum, http://www.artima.com/weblogs/viewpost.jsp?thread=4829
“Python Idioms and Efficiency”, http://jaynes.colorado.edu/PythonIdioms.html
“Python track: python idioms”, http://www.cs.caltech.edu/courses/cs11/material/python/misc/python_idioms.html
“Be Pythonic”, Shalabh Chaturvedi, http://shalabh.infogami.com/Be_Pythonic2
“Python Is Not Java”, Phillip J. Eby, http://dirtsimple.org/2004/12/python-is-not-java.html
“What is Pythonic?”, Martijn Faassen, http://faassen.n--tree.net/blog/view/weblog/2005/08/06/0
“Sorting Mini-HOWTO”, Andrew Dalke, http://wiki.python.org/moin/HowTo/Sorting
“Python Idioms”, http://www.gungfu.de/facts/wiki/Main/PythonIdioms
“Python FAQs”, http://www.python.org/doc/faq/