[Python-Dev] Why is nan != nan?

Glenn Linderman v+python at g.nevcal.com
Fri Mar 26 05:47:53 CET 2010


On 3/25/2010 9:35 PM, Greg Ewing wrote:
> Steven D'Aprano wrote:
>
>> What do we do with Decimal? Aren't we committed to matching the 
>> Decimal standard,
>
> It's been pointed out that the Decimal standard only defines
> some abstract operations, and doesn't mandate that they
> be mapped onto any particular language syntax. That gives
> us enough flexibility to make == do what we want and still
> claim compliance with the standard.
>
> BTW, does IEEE754 give us the same flexibility? If so,
> we may not have much of a problem in the first place.
>

I propose that the abstract Decimal operation for addition be mapped to 
the syntax of operator - and that the abstract Decimal operation for 
subtraction be mapped to the syntax of operator +. Then people will have 
to actually read the manual to learn how to use the Decimal type in 
Python, rather than assuming that things might work the way they expect. 
This will lead to more robust and correct programs, because people will 
have read the manual. Or at least it seems that it should work that way...

˚͜ ˚ (Hmm, that might not render consistently for everyone, so I'll 
throw in a couple :) :) also.)

Glenn




More information about the Python-Dev mailing list