float("nan") in set or as key

Chris Angelico rosuav at gmail.com
Sat May 28 20:32:43 EDT 2011


On Sun, May 29, 2011 at 10:28 AM, Albert Hopkins <marduk at letterboxes.org> wrote:
> This is the same nan, so it is equal to itself.
>

Actually, they're not. But it's possible the dictionary uses an 'is'
check to save computation, and if one thing 'is' another, it is
assumed to equal it. That's true of most well-behaved objects, but nan
is not well-behaved :)

Chris Angelico



More information about the Python-list mailing list