一个tuple发生在Python的内存空间少:
tuple
>>> a = (1,2,3) >>> a.__sizeof__() 48
而lists需要更多的内存空间:
list
>>> b = [1,2,3] >>> b.__sizeof__() 64
Python内存管理内部会发生什么?
python tuples list python-2.7 python-internals
list ×1
python ×1
python-2.7 ×1
python-internals ×1
tuples ×1