codehaus


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

what's the differences: None and null?


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.