Message213602
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 intersection by starting with the smaller set. I may mis-remember but I believe we changed after someone noticed that something like {1] & set(range(10000)) versus set(range(10000)) & {1} had very different run times.
I agree with Raymond that the docs for intersection and union should be left as is.
I could read the doc for A.intersection_update(B) as saying that it keeps all items in A that also appear in B, with appear defined on the basis of ==, so that the result is a subset of the actual items in A. If that is the intent, it could be made clearer.
The doc A.update(B) (union) come close to saying that all items in A remain and items in B not in A get added, so that the result all the items in A. Again, if that is the intent, it could be made explicit, and people who want to determine which operand wins could use the update functions to do so. |
|
Date |
User |
Action |
Args |
2014-03-14 23:56:39 | terry.reedy | set | recipients:
+ terry.reedy, rhettinger, stutzbach, steven.daprano, r.david.murray, docs@python, Giacomo.Alzetta, Balakrishnan.B |
2014-03-14 23:56:39 | terry.reedy | set | messageid: <1394841399.49.0.929605961713.issue20902@psf.upfronthosting.co.za> |
2014-03-14 23:56:39 | terry.reedy | link | issue20902 messages |
2014-03-14 23:56:39 | terry.reedy | create | |
|