what's the differences: None and null?

ast none at gmail.com
Sun Sep 15 09:17:54 EDT 2019


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:
     pass



More information about the Python-list mailing list