[issue20902] Which operand is preferred by set operations? Missing information in the documentation

2014-03-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks Terry. And yes, your reading of the set.update() docs is correct, Update the set, adding elements from all others means that it updates the set by adding the elements from the other sets. FWIW, getting into details about which value wins goes

[issue20902] Which operand is preferred by set operations? Missing information in the documentation

2014-03-14 Thread Terry J. Reedy
Terry J. Reedy added the comment: Defining equality to ignore the .value attribute (and the id), says that they *do not matter*. Python believes you and the interpreter does what it does. If we had made a 'first or second operand wins' claim, we would not have been able to optimize

[issue20902] Which operand is preferred by set operations? Missing information in the documentation

2014-03-13 Thread Giacomo Alzetta
Giacomo Alzetta added the comment: I asked this because, for example, in Haskell it *is* a well-defined behaviour (see its documentation at: http://hackage.haskell.org/package/containers-0.5.4.0/docs/Data-Set.html): the left operand is preferred by all operations. In fact, working with

[issue20902] Which operand is preferred by set operations? Missing information in the documentation

2014-03-13 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: docs@python - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20902 ___

[issue20902] Which operand is preferred by set operations? Missing information in the documentation

2014-03-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: As far as I can tell currently there is no rule about this. Intersection prefers the second operand, while union prefers the first. The implementation uses the same logic as found in Lib/sets.py where the intersection operator loops over the SMALLER of

[issue20902] Which operand is preferred by set operations? Missing information in the documentation

2014-03-12 Thread Giacomo Alzetta
New submission from Giacomo Alzetta: Currently the documentation for set (at: http://docs.python.org/2/library/stdtypes.html#set) does not mention which operand is preferred when performing the usual binary operations. For example the following sample code doesn't have a defined result

[issue20902] Which operand is preferred by set operations? Missing information in the documentation

2014-03-12 Thread R. David Murray
R. David Murray added the comment: If you take the intersection or union of a set, it shouldn't matter which set the element came from, by the axioms that apply to sets. So it if does, that's an application bug, IMO. -- nosy: +r.david.murray ___

[issue20902] Which operand is preferred by set operations? Missing information in the documentation

2014-03-12 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- nosy: +stutzbach ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20902 ___ ___ Python-bugs-list mailing

[issue20902] Which operand is preferred by set operations? Missing information in the documentation

2014-03-12 Thread R. David Murray
R. David Murray added the comment: Or, to put it another way, which set it comes from is not documented because it is an implementation detail and can not be depended on. I'm sure someone will correct me if I'm wrong :) -- nosy: +rhettinger ___

[issue20902] Which operand is preferred by set operations? Missing information in the documentation

2014-03-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: If this is undefined, and I think it should be, the docs should explicitly say so. How is this? The union and intersection operations select elements which appear in both operands, e.g. set([a, b, c]) set([c, d, e]) returns set([c]). The selection is

[issue20902] Which operand is preferred by set operations? Missing information in the documentation

2014-03-12 Thread R. David Murray
R. David Murray added the comment: Sounds good to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20902 ___ ___ Python-bugs-list mailing list

[issue20902] Which operand is preferred by set operations? Missing information in the documentation

2014-03-12 Thread Balakrishnan B
Changes by Balakrishnan B balakrishnan.er...@gmail.com: -- nosy: +Balakrishnan.B ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20902 ___ ___

[issue20902] Which operand is preferred by set operations? Missing information in the documentation

2014-03-12 Thread Benjamin Peterson
Changes by Benjamin Peterson bp+pyb...@benjamin-peterson.org: -- keywords: +easy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20902 ___ ___