Dictionary Comparison Operations
Some of the standard comparisons (<,
<=, >, >=,
==, !=) don't have a lot of meaning between
two dictionaries. Since there may be no common keys, nor even a common
data type for keys, dictionaries are simply compared by length. The
dict with fewer elements is considered less than
a dict with more elements.
The membership comparisons (
in
,
not
in
) don't apply to dictionaries at all. It would be unclear
whether the key or the value is referenced. Dictionaries have more
sophisticated membership tests; we'll cover these under member methods,
below.