Python Semantics
Do you actually know what Python is doing?
-
Names & Identity
A name is a binding, not a box.
After Names & Identity
Function Arguments
Binding, not copying.
After Names & Identity
Mutability & Aliasing
Two names, one list.
After Names & Identity
Scope & Namespaces
Local, enclosing, global, built-in.
After Function Arguments, Scope & Namespaces
Default Arguments
Built once, reused forever.
After Mutability & Aliasing
Containers & Hashing
Equal, hashable, ordered.
After Scope & Namespaces
Closures & Late Binding
What a function remembers.
After Function Arguments
Exceptions & Context Managers
Cleanup you can trust.
After Containers & Hashing
Class & Instance State
Whose dictionary is it?
After Closures & Late Binding, Containers & Hashing
Iterators & Generators
Lazy until asked.
After Class & Instance State
Inheritance & Dunder Protocols
How Python looks things up.
After Iterators & Generators, Exceptions & Context Managers
Decorators & Imports
Functions wrapping functions.
After Decorators & Imports
Typing & Performance
Hints, duck typing, and Big-O in practice.
After Typing & Performance
Concurrency & Async
The GIL, threads, and await.
After Typing & Performance
Memory & CPython Internals
Under the object model.