On Fri, Mar 6, 2015 at 2:26 PM, Ben Finney <ben+pyt...@benfinney.id.au> wrote: > Isn't the point at issue that the Python interpreter *may* optimise by > assuming ‘is implies equality’, so the ‘in’ operator can fail if that > assumption is false? > > I thought the problem was that types with custom behaviour, as with the > ‘NullType’ example, needed to deal specially with the ‘is implies > equality’ optimisation Steven explained. > > If that's the correct behaviour, and we can *depend* on it being > correct, then I don't see what the problem is.
I'm not sure it's just an optimization. Compare this post from python-dev, where Nick Coghlan discusses the same topic: https://mail.python.org/pipermail/python-dev/2014-July/135476.html ChrisA -- https://mail.python.org/mailman/listinfo/python-list