Terry J. Reedy <[email protected]> added the comment:
Given that equality is not identify, order does matter, although in 3.2.2 the
results are the opposite of what one might expect.
a = set((1,2,3))
b = set((1.0, 3.0, 5.0))
print(a&b, b&a)
print(a.intersection(b), b.intersection(a))
a &= b
print(a)
>>>
{1.0, 3.0} {1, 3}
{1.0, 3.0} {1, 3}
{1.0, 3.0}
In my view, a &= b should remove the members of a that are not in b, rather
than deleting all and replacing some with equal members of b.
That glitch aside, & remains and remains binary for exact control of order. The
doc should just say that intersection may re-order the intersection for
efficiency.
----------
nosy: +terry.reedy
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue13653>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com