0
None == False
...is False, but why?
7 odpowiedzi
+ 5
But:
bool(None) == False
...will be True :)
+ 2
Thanks, Mirielle
You’re right:
>>> type(None)
<class 'NoneType'>
>>> type(False)
<class 'bool'>
+ 2
Prof. Dr. Zoltán Vass
None and false are very different in type:
None is a datatype of the type "None"
False is a datatype of the type "bool"
Thus when you type:
None==False
It will return false because these are not the same.
But if you change your code and write:
bool (None)==False.
It will return true. Because none being the datatype none it will return a value of bool equal to zero. Thats why it will return true
+ 1
"None" doesn't exist any data type . that's why