+ 2

why empty dictionary not equal to None ?

13th Aug 2016, 9:12 AM
Akash Fataniya
4 Answers
+ 1
A empty dictionary is a dictionary. It has a type. None has no type. Something with a type can't be equal to something with no type.
2nd Nov 2016, 3:35 PM
Nicolas Sanson
Nicolas Sanson - avatar
0
Because the type is different. Specifically, you can add a pair key:val to a dictionary, but not to a None
15th Oct 2016, 7:17 AM
Piter Bunt
Piter Bunt - avatar
0
In Python, an empty dictionary or any other container(like lists, tuples, sets, etc) always evaluates to a Boolean False value, not None. You can find the detailed explanation here.. https://programmersportal.com/how-to-check-if-a-dictionary-is-empty-in-python/
17th Oct 2021, 2:58 AM
Bhaskar Rana
- 1
it's not none. it has no element. thats it
13th Aug 2016, 1:34 PM
Gilli Vimalraj
Gilli Vimalraj - avatar