Under and Dunder - Python secret functions
summary
Covers Python’s single-underscore convention and double-underscore name mangling, shows how dir() exposes attributes, and demonstrates concrete dunder methods: implementing __getitem__, __len__, __iter__ and __next__ to make a custom Sequence class that returns squares for indexing, reports length as 999, and yields the value seven repeatedly until a counter triggers StopIteration. Live notebook examples show how secret methods get renamed, when they can be called internally, and how iterator protocols actually drive for-loops.
AI-written summary · about
chapters (9)
- 0:00Intro
- 0:18Welcome
- 0:38About me
- 2:40Python internal functions
- 11:40Object attributes
- 14:10List
- 16:40Length
- 18:30Iterator
- 24:30Conclusion
related talks
16mUnder and Dunder - Python secret functions
31mLife Under the A Guide to Python's Internal Conventions
25mThe Magic of Python
25mAdvanced Python
27mUnder the Hood Hacking Python Data Types for Fun and Power
33mElegant Solutions For Everyday Python Problems
25mLet's implement useless Python objects
28mLoop better: a deeper look at iteration in Python
