~/talk

Modules 101: how to avoid spaghetti, big balls of mud and houses of straw!

Talkat PyCon Australia 2013 · 2013-07-05..07-07· [python, developer-experience]
links:none on file
slides:none on file

Covers concrete module and package mechanics: how import executes and searches sys.path, why modules run once at import and how naming collisions with the standard library break code, and why from module import is dangerous with copied names and surprising globals. Shows practical bits: using __name__ == "__main__" for tests, __init__.py vs namespace packages, using __all__, shipping packages as zip, and differences in reload between Python 2 and 3*. Good for beginners who want actionable rules rather than theory.

AI-written summary · about

  1. 0:00Intro
  2. 1:05"Building" software
  3. 4:14Getting design right is critical
  4. 6:11Some basic design principles
  5. 7:50Why use modules and packages?
  6. 8:14Far nicer than spaghetti!
  7. 8:34What is a module?
  8. 10:11Module search paths
  9. 10:58Namespaces
  10. 15:14Avoid clutter and clashes
  11. 15:44reload
  12. 18:02Executing modules
  13. 19:12Documenting modules
  14. 21:10Defining packages: __init__.py
  15. 22:01Subpackages
  16. 22:34Fun & interesting modules
  17. 23:04Executable modules
  18. 23:21Advanced topics to explore next
  19. 25:19These notes
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.