What is the value of None in memory?

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

    It turns out that None consumes 16 bytes and that's actually too much for simply an empty value.

    None ist not an empty value. It is an NoneType object which represents the absence of a value as you can read here: Python Built-in constants Doc. You can assign None to variables, but you can't assign to None, as it would raise an syntax error.

提交回复
热议问题