What is the value of None in memory?

前端 未结 4 432
借酒劲吻你
借酒劲吻你 2021-01-11 17:59

None in Python is a reserved word, just a question crossed my mind about the exact value of None in memory. What I\'m holding in my mind is this, <

4条回答
  •  悲&欢浪女
    2021-01-11 18:27

    None references some Python object of the NoneType, actually the only instance of its kind. Since it’s a Python object—like literally every other thing—it’s not just the raw content what is stored about also the additional object information like its type.

    Every object has this overhead; that’s why integers start with a size of 28 for example. You cannot change this, it’s an implementation detail of Python and its type system.

提交回复
热议问题