Author terry.reedy
Recipients r.david.murray, rhettinger, steven.daprano, terry.reedy, vfaronov
Date 2016-07-29.17:56:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1469814985.95.0.332912967763.issue27605@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-07-29 17:56:26terry.reedysetrecipients: + terry.reedy, rhettinger, steven.daprano, r.david.murray, vfaronov
2016-07-29 17:56:25terry.reedysetmessageid: <1469814985.95.0.332912967763.issue27605@psf.upfronthosting.co.za>
2016-07-29 17:56:25terry.reedylinkissue27605 messages
2016-07-29 17:56:25terry.reedycreate