what's the differences: None and null?

Random832 random832 at fastmail.com
Fri Sep 13 21:40:13 EDT 2019


On Fri, Sep 13, 2019, at 21:22, Hongyi Zhao wrote:
> what's the differences: None and null?

null isn't really a concept that exists in Python... while None fills many of the same roles that null does in some other languages, it is a proper object, with __str__ and __repr__ methods (that return 'None'), __hash__ (that returns an arbitrary value), etc.

NULL, the C/C++ null pointer, is used in CPython for things like error returns, things like slots or cell variables that are not initialized (as opposed to being set to None), etc. This is an implementation detail, and should never come up in Python code.



More information about the Python-list mailing list