Yes, an int
instance takes 12 bytes on your system. Whole elements (for example, any object) have attributes, that is, pointers to other objects that occupy additional memory space outside, used by the eigenvalue of the object. So, 4 bytes for an integer value, 4 bytes for a pointer to __class__
(otherwise Python would not know what type the object belonged to, and how to start resolving attribute names that are inherited from the int
class and its parents) and 4 more to count references to objects used by the garbage collector.
The int
type takes 436 bytes on your system, which will point to various methods and other attributes of the int
class and any other utility information required by Python for the class. The int
class is written in C in the standard Python implementation; you can look at the source code and see what is there.
source share