Author terry.reedy
Recipients dalke, rhettinger, terry.reedy
Date 2011-12-24.03:48:21
SpamBayes Score 0.000594851
Marked as misclassified No
Message-id <1324698502.02.0.549742906044.issue13653@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-12-24 03:48:22terry.reedysetrecipients: + terry.reedy, rhettinger, dalke
2011-12-24 03:48:22terry.reedysetmessageid: <1324698502.02.0.549742906044.issue13653@psf.upfronthosting.co.za>
2011-12-24 03:48:21terry.reedylinkissue13653 messages
2011-12-24 03:48:21terry.reedycreate