Message271640
Here is a more accurate 'equivalent': "any(x is e or <one of x==e or e==x> for e in <candidate members of y>)" where 'candidate members' is "members with the same hash as x" for built-in hash-based collections and 'all members' for built-in unsorted sequences". I am sure that built-in range does a direct calculation. Instead of the above, I suggest this.
"For general collections, such as list, tuple, collections.deque, and most iterables, the expression `x in y` is usually equivalent to `any(x is e or x == e for e in y)`."
Hash-based collections should not be mentioned in such a sentence as the equivalency is completely wrong, as Steven noted. |
|
Date |
User |
Action |
Args |
2016-07-29 17:56:26 | terry.reedy | set | recipients:
+ terry.reedy, rhettinger, steven.daprano, r.david.murray, vfaronov |
2016-07-29 17:56:25 | terry.reedy | set | messageid: <1469814985.95.0.332912967763.issue27605@psf.upfronthosting.co.za> |
2016-07-29 17:56:25 | terry.reedy | link | issue27605 messages |
2016-07-29 17:56:25 | terry.reedy | create | |
|