3

Python 一个整型居然最少 24 字节

 2 years ago
source link: https://www.v2ex.com/t/821244
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  Python

Python 一个整型居然最少 24 字节

  ruxuan1306 · 7 小时 24 分钟前 · 1804 次点击
print(sys.getsizeof(0))        # 24
print(sys.getsizeof(1))        # 28 
print(sys.getsizeof(2))        # 28
print(sys.getsizeof(2**15))    # 28
print(sys.getsizeof(2**30))    # 32
print(sys.getsizeof(2**128))   # 44

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK