I intend to get the max size of int
In [1]: import sys
In [2]: sys.getsizeof(int)
Out[2]: 400
Does it mean that the maxint in python is 2**40
However, when I tried
In [5]: types = [int, float, complex, list, tuple, dict, set, True, False, None]
In [7]: [sys.getsizeof(type) for type in types]
Out[7]: [400, 400, 400, 400, 400, 400, 400, 28, 24, 16]
all the data types are 400 bytes.
What does it 400 bytes mean for integer?
In your code you're getting the size of the class not of an instance of the class.
Call int to get the size of an instance, like the following code
>>> sys.getsizeof(int())
24
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With