I have a question about space in the memory used by list and dict objects.
My Python 3.7 shell shows:
>>> import sys
>>> list_ = []
>>> sys.getsizeof(list_)
64
>>> dict_ = {}
>>> sys.getsizeof(dict_)
240
>>> list_ += dict_,
>>> list_
[{}]
>>> sys.getsizeof(list_)
96
I don't understand what is going on.
- The listobject takes64bytes of memory (what's shown in shell)+ 8bytes for each element.
- The - dictobject takes- 240bytes of memory.
- So, after adding the dictionary as an element, the - listshould take- 64 + 8 + 240 = 312bytes.
Why did the memory taken by the list increase by only 32 bytes?  What happened to the dict's 240 bytes memory? And why did the amount of memory used increase by just 32 bytes?  
 
     
    