Message150206
| Author |
terry.reedy |
| Recipients |
dalke, rhettinger, terry.reedy |
| Date |
2011年12月24日.03:48:21 |
| SpamBayes Score |
0.00059485104 |
| 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:22 | terry.reedy | set | recipients:
+ terry.reedy, rhettinger, dalke |
| 2011年12月24日 03:48:22 | terry.reedy | set | messageid: <1324698502.02.0.549742906044.issue13653@psf.upfronthosting.co.za> |
| 2011年12月24日 03:48:21 | terry.reedy | link | issue13653 messages |
| 2011年12月24日 03:48:21 | terry.reedy | create |
|