Python 103: Mmmm... Understanding Python's Memory Model, Mutability, and Methods
summary
Explains concrete internals: objects are labels on values, reference counting plus a cycle detector, and small integers are -5 to 256 interned so identity surprises happen; mutable vs immutable drives bugs (aliases vs copies), use copy.deepcopy for true deep copies but it’s seldom needed. Shows a Time60 class with __str__ and __add__ (handles base‑60 carry), demos using timeit to spot costly repeated calls, describes list growth/shrink allocation strategy and recommends deque for heavy front inserts. Also warns against __del__ and shows a text‑to‑PowerPoint script built and used.
AI-written summary · about
chapters (21)
- 0:00Intro
- 2:22About this talk & you
- 3:55How to Create a Class
- 6:46Function/Method Evaluation
- 11:23More About Class Instances
- 13:44How to Create a Subclass
- 22:26Python Type Emulation
- 23:24Special Class Methods
- 33:50Overriding Special Methods
- 37:10Stack Utilization During Execution
- 38:48The Stack and Execution Speed
- 46:08Introduction to Python Objects
- 47:51Objects and References
- 50:53Reference Count Increased
- 53:34Reference Count Decreased
- 54:18Categorizing the Standard Types
- 56:27Storage Model
- 56:54Update Model
- 57:54Access Model
- 58:35Type Categorization Summary
- 59:14Objects & References Quiz
related talks
25mIs it me or Python memory management? 🤔💻
23mPython Memory Understanding
23mMemoirs of a Python Object: Memory Management and Improving Performance
27mVariables and objects in Python: it's pointers all the way down
27mPython Oddities Explained
31mPlaying with CPython Objects Internals
01h 07mWhat Does It All Really Mean
25mThe Magic of Python
