Comparing dictionaries, is this valid Python?

Tim Peters tim.peters at gmail.com
Tue Dec 13 20:44:02 EST 2005


[François Pinard]
...
> Would someone know where I could find a confirmation that comparing
> dictionaries with `==' has the meaning one would expect (even this is
> debatable!), that is, same set of keys, and for each key, same values?

Yes, look here <wink>:  it has the meaning you expect, provided that
by "same" you mean "compare equal" (and not, e.g, "is").

See the Language Reference Manual, section 5.9 "Comparisons", for
more, and footnote 5.5 there for a bit of history.



More information about the Python-list mailing list