This folder has no README. Everything inside it is listed below.
Notes
- Mutable default arguments
- Late-binding closures
- is vs == and string/int interning
- bool is a subclass of int
- Class variable vs instance variable
- List multiplication and aliasing
- Chained comparisons
- Generator exhaustion
- async def returns a coroutine, doesn't run
- super() and MRO with multiple inheritance
- Walrus operator (:=) gotchas
- Comprehension scope
- += on an immutable inside a dict
- id() reuse after garbage collection
- Implicit string concatenation
- dict.get(k, default) and falsy values
- Floats and equality
- Dataclass mutable defaults
- Starred unpacking
- Exception swallowing in finally
- Circular imports
- Descriptor invocation order
- Empty Class as Dictionary Key in Python · 3 angles
- Metaclass vs class decorator
- pickle security
- nonlocal vs global
- yield from semantics
- Blocking calls in async def
- Decorator with arguments
- functools.wraps
- Collection complexity (list / tuple / set / dict)
- Truthiness of containers and falsy values
- Positional-only and keyword-only parameters (/ and *)
- Mutating a dict key after insertion
- True, 1, and 1.0 as the same dict key
- float('nan') as a dict key
- Self-referential dicts (and lists)
- Mutating a dict during iteration
- setdefault always evaluates the default
- __missing__ — and why .get() doesn't trigger it
- Merging dicts: {a, b} vs a | b vs update vs ChainMap
- Duplicate keys in dict comprehensions
- Inverting a dict — what could go wrong
- dict.fromkeys shares a single default object
- frozenset vs tuple as a dict key
- Dict insertion order — when did it become a guarantee?
- d[k] vs d.get(k) vs d.setdefault(k, v) vs defaultdict
- Dict shallow copy trap — nested mutables are shared