intersection, union, difference, symmetric difference for dictionaries
davea at davea.name
Tue Feb 25 22:35:50 CET 2014
mauro <mauro at gmail.com> Wrote in message:
> Dictionaries and sets share a few properties:
> - Dictionaries keys are unique as well as sets items
> - Dictionaries and sets are both unordered
> - Dictionaries and sets are both accessed by key
> - Dictionaries and sets are both mutables
> So I wonder why operations such us intersection, union, difference,
> symmetric difference that are available for sets and are not available
> for dictionaries without going via key dictviews.
I certainly wouldn't be able to guess what they should be defined
to do, since there are several equally obnoxious possibilities.
For instance, take union for example. What should be the result
when you union two dicts that have the same key but different
values for that key?
More information about the Python-list