[Python-ideas] [Python-Dev] hello, new dict addition for new eve ?

Nathan Rice nathan.alexander.rice at gmail.com
Tue Jan 3 17:59:45 CET 2012


This is slightly tangential, but I've always wondered... Why aren't
set operations implemented on dicts?  It is fairly natural to view a
dictionary as a set of (key, value) pairs.  Things like
subset/superset checking (with concomitant operator support) make
sense.  I have written stuff like set(dict1.items()) <
set(dict2.items()) many times.

I don't even know what rich comparison operators on dictionaries do
now, it isn't intuitive at all.

Nathan



More information about the Python-ideas mailing list