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

what's the differences: None and null?

Le 14/09/2019 ? 03:40, Random832 a ?crit?:
> 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.

I add that None is a singleton. There is only one None object.
So testing if a variable is None is done with identity check:

if var is None: