Understanding Python object storage and memory references
This question tests your mental model of how Python stores numeric values in memory and how the interpreter manages object identity versus value. It's a deceptively simple question that reveals whether you understand Python's reference semantics and the distinction between the object itself and the variable that points to it.
To answer this correctly, you need to think concretely about where data actually lives in a running Python process—not just "in a variable" but in which memory region, and how Python's object model organizes that storage. This touches on the difference between the stack, heap, and the object cache Python maintains for small integers.
- Object identity and the
id() function - Python's integer interning for performance
- The heap and reference semantics
- How variables hold references, not values directly