Is nan in (nan,) correct?

Chris Angelico rosuav at gmail.com
Thu Mar 5 22:49:02 EST 2015


On Fri, Mar 6, 2015 at 2:26 PM, Ben Finney <ben+python at 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



More information about the Python-list mailing list