CPython's Cell Implementation in C: The One-Pointer Box Behind nonlocal
A cell is a box with a single pointer in it, and closures work because two frames share the same box — not the same value — which is why late-binding captures the variable.
A cell is a box with a single pointer in it, and closures work because two frames share the same box — not the same value — which is why late-binding captures the variable.
A code object is pure, shareable syntax: bytecode plus constants, names, a unified localsplus layout, and two compact byte tables — the linetable and the exception table.
A complex number is 32 bytes: an object header plus two doubles. Arithmetic comes in a fast mixed-mode macro, and hashing guarantees hash(x+0j) == hash(x).
A coroutine is a generator with a different flag: CO_COROUTINE picks the type, RETURN_GENERATOR hands back the frame, and am_await wraps it so you can drive it like an iterator.
A descriptor is a type with tp_descr_get (and maybe tp_descr_set). Having a setter is what makes it a data descriptor — and that single bit decides who wins an attribute lookup.