Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'difference,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'wrote': 0.14; "wouldn't": 0.14; 'dictionaries': 0.16; 'key?': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:dictionaries': 0.16; 'symmetric': 0.16; 'unordered': 0.16; 'do,': 0.16; 'certainly': 0.24; 'example.': 0.24; 'instance,': 0.24; 'defined': 0.27; 'values': 0.27; 'header:X -Complaints-To:1': 0.27; 'wonder': 0.29; 'sets': 0.30; 'keys': 0.31; 'guess': 0.33; 'operations': 0.35; 'but': 0.35; 'there': 0.35; 'should': 0.36; 'two': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'such': 0.63; 'different': 0.65; 'union': 0.69; 'union,': 0.84; 'subject::': 0.85 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dave Angel Subject: Re:intersection, union, difference, symmetric difference for dictionaries Date: Tue, 25 Feb 2014 16:35:50 -0500 (EST) Organization: news.gmane.org References: X-Gmane-NNTP-Posting-Host: dpc6744193198.direcpc.com X-Newsreader: PiaoHong Usenet NewsReaders 1.36 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393363922 news.xs4all.nl 2859 [2001:888:2000:d::a6]:39592 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67062 mauro 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? -- DaveA