On Sun, 29 May 2011 10:32:43 +1000, Chris Angelico wrote: > On Sun, May 29, 2011 at 10:28 AM, Albert Hopkins > <mar...@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 :)
*Exactly* correct. NAN != NAN even if they are the same NAN, by design. This makes NANs ill- behaved, but usefully so. Most (all?) Python built-ins assume that any object X is equal to itself, so they behave strangely with NANs. -- Steven -- http://mail.python.org/mailman/listinfo/python-list