CPython Interns Strings
CPython keeps a global table of immortal static strings and a per-interpreter dict of mortal runtime ones, so equal strings can be compared by pointer.
CPython keeps a global table of immortal static strings and a per-interpreter dict of mortal runtime ones, so equal strings can be compared by pointer.
CPython’s pymalloc hands out objects up to 512 bytes from a free list inside a size-class pool, so the fast path is one array lookup, one comparison, and one pop.
Hot bytecode gets rewritten in place behind a version-tag guard: when the type or dict changes, the tag moves and the interpreter falls back to the generic path.