I noticed the following fact in python:
>>> (1, 2, 3).__sizeof__()
48
>>> [1, 2, 3].__sizeof__()
64
I understand the difference between list and tuple but I expected their sizeof (size of object in memory)
to be the same: both come with methods and both contain same values.
Moreover, the size difference depends on items lenght:
>>> for size in (10, 100, 1000, 10000):
tuple_ = tuple(range(size))
list_ = list(range(size))
print list_.__sizeof__(), tuple_.__sizeof__()
176 104
984 824
9088 8024
90088 80024
- How can we explain this ?
- Where can I find good doc for python internals ?