On Wed, 20 Sep 2017 10:07 pm, Steve D'Aprano wrote: > I'm not sure whether to be surprised or not. > > The first one only checks for identity, which should be really fast, while the > `is` operator tests for equality too,
Oops, that's supposed to be `in`, not `is`. [...] > Ah... I see that Robin is using especially small tuples, of only three items. > Yes, I can see why the overhead of the generator expression would slow that > down. But try it with a list of a thousand values... > > ... and the `is` operator is still faster. Today I learned something. And *that* should be `in`. Sigh. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list