5 Years of Bad Ideas
summary
Five years of practical Python magic: concrete techniques include using sys._getframe to inspect callers, metaclasses and bytecode rewriting to inject an implicit self, AST transforms and import hooks to rewrite code, and an implemented GitHub importer that loads modules directly (500 HTTP requests, very slow). A working multiversion proof‑of‑concept renames modules in sys.modules and serves per-caller versions; it mostly works but relies on fragile internals, ctypes trace patching for readable template tracebacks can crash on some builds, and live reloading requires global locking and careful design.
AI-written summary · about
chapters (20)
- 0:00Intro
- 0:36General Idea
- 1:38What is Magic
- 5:40What is Classes
- 6:14Xik
- 7:36AC
- 9:44Import hooks
- 10:58Monkey patching
- 11:13Under on a building
- 12:48System Modules
- 14:55Overloading
- 16:03Monkey Patch
- 17:54Internal Warfare
- 18:12Local Functions
- 21:18Frame
- 22:26implicit self
- 24:08return value use
- 25:38names
- 30:10ABCDE
- 31:18Bad Ideas
related talks
24m"A Confession of My Python Sins"
31mDon't Do This
43mPython 3: ten years later
57mTechniques learned from five years finding the way for Rust in Python
01h 14mThe Five Kinds of Python Functions
51mBuilding useful project utils in Python
43mPython and Johnny Cash
01h 10mKeynote 2: Robust Python and Why It Matters
