In article <G57Pu.24239$th2.4...@tornado.fastwebnet.it>, mauro <ma...@gmail.com> wrote: > 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.
This is a plain bad idea. Dictionaries correspond to the mathematical concept of a mapping. A mapping (or a function) is a set in math, as everything is a set. It is a subset of the product set of two set A and B where there is exactly one pair for each a in A. No sane mathematician talks about unions, intersections etc. of those sets, though clearly they are well defined. OTOH there is a very rich vocabulary specific for the properties of functions. So dear mauro do as everybody does, as soon as you've invented something useful related to dicts, you'll discover that it correspond to an age old mathematical concept. It is unwise not to borrow its name. Those old geezers, Chebychov, Euler, Laplace, Fourier had their marbles in a row. It is hard to outsmart them. Groetjes Albert -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst -- https://mail.python.org/mailman/listinfo/python-list