The Virtues of Being Lazy
summary
Describes a concrete claim: Python 3.15 adds a lazy keyword that defers module imports to first use and measurably cuts startup time and memory. Live demo shows importing pandas taking about 7 seconds on an older i7 and then becoming instant when unused under lazy imports. Details: lazy is a soft keyword, thread safe, works with from but not star imports, does not cascade and is resolved at access, can be forced with resolve and moves ModuleNotFoundError to use time.
AI-written summary · about
chapters (10)
- 0:00Lazy programming intro
- 1:08Three virtues of lazy
- 2:55Live coding self-documenting
- 8:32Python 2 vs 3 lazy eval
- 12:51Startup latency with lazy imports
- 17:33Python 3.15 lazy keyword
- 21:21Soft keywords and mechanics
- 24:58Lazy imports pitfalls & benefits
- 27:15Summary of lazy techniques
- 29:01Closing remarks
related talks
30mLazy imports and the art of interpreter procrastination
25mThe Bakery: How PEP810 sped up my bread operations business
27mNo time to idle about: Profiling import time in Python
28mImport Deep Dive
19mPython - best practices
02mTutorial Sneak Peek: "Lazy Looping in Practice..."
29mI wish I learnt that earlier!
17mCache me if you can: Boosting performance with Data Caching in Python
