CPython's NotImplemented Implementation in C
NotImplemented is an immortal static singleton that binary operators return to say ’not my job’ — the interpreter then tries the reflected operand before raising TypeError.
All posts published on this site.
Everything published here, newest first.
NotImplemented is an immortal static singleton that binary operators return to say ’not my job’ — the interpreter then tries the reflected operand before raising TypeError.
object is a 16-byte struct holding just ob_refcnt and ob_type — and PyBaseObject_Type fills in the defaults every other type inherits or overrides.
OrderedDict is a dict subclass with a linked list of keys and a lazily rebuilt mirror array, giving O(1) node lookup without touching every dict resize.
PickleBuffer is a tiny C object that holds one Py_buffer view and forwards every buffer request straight to the original exporter — no copies, no managed-buffer layer.
A PyCapsule is a typed, name-checked void* wrapper: the name stops you reading the wrong capsule, and the destructor gets one shot to clean up before the memory goes.