What is the value of None in memory?

前端 未结 4 426
借酒劲吻你
借酒劲吻你 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:36

    None is singleton object which doesn't provide (almost) none methods and attributes and its only purpose is to signify the fact that there is no value for some specific operation.

    As a real object it still needs to have some headers, some reflection information and things like that so it takes the minimum memory occupied by every python object.

提交回复
热议问题