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

Steven D'Aprano report at bugs.python.org
Wed Mar 12 23:46:20 CET 2014

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 performed by equality, not object identity, and which specific object is returned (the c object from the first set or the second set) is an implementation detail and cannot be relied on.

nosy: +stevenjd

Python tracker <report at bugs.python.org>

More information about the docs mailing list