Oh Python! Where Did We Go Wrong
summary
Python code quality suffers from specific, repeatable choices: top‑level modules execute network calls at import, ORMs that mimic active record hide database effects, and heavy subclassing produces tangled control flow that makes a method call jump up and down hierarchies. A Flask example shows a CRUD API for "fuars" with no input validation leading to 500s and HTML errors; switching to Flask‑RESTful fixes JSON errors but Flask‑RESTful hides URLs and forces extra classes. Excessive decorator use — notably decorator stacking of seven wrappers — breaks debugging; the practical fix is prefer composition over inheritance.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 1:06Python's early strengths
- 3:36Unexpected language features
- 7:06Dangers of subclassing
- 11:40Case study API design
- 15:56Flask Restful critique
- 21:57Decorators done right
- 26:14Decorator stacking anti-pattern
- 34:45Clarity over cleverness
- 36:36Q&A
related talks
53mBuilding secure web apps: Python vs the OWASP Top 10
24mPython for Humans, Designing Python Code Like a User Interface
24m"A Confession of My Python Sins"
26mDesigning APIs with Flask
46mOn Being Pythonic
59mCommon Python Coding Mistakes
41mEcosystem for Reliable Python Programming
41mThe Snake in the Tar Pit: Complex Systems with Python
