Python · The Python Data Model · Intermediate · 28 min read
The Python Data Model: Special Methods, Protocols and How Objects Really Work
Learn the idea that makes Python consistent. Special (dunder) methods let your objects work with len, indexing, iteration, with, operators and printing. Build a playlist container and a duration class, understand repr versus str, truthiness, and why you call len(x) instead of x.len().
Create an account to start
Create a free account to see what this lesson covers
- Every free lesson in every section, in full
- Track your progress and pick up where you left off
- Free practice questions and an incident simulation
- Takes under a minute: name, email and a password
No card needed. Full access to Python is a paid upgrade you can choose later.