[Python-Dev] Mixing float and Decimal -- thread reboot

Guido van Rossum guido at python.org
Wed Mar 24 20:51:13 CET 2010

On Wed, Mar 24, 2010 at 11:55 AM, Alexander Belopolsky
<alexander.belopolsky at gmail.com> wrote:
> On Wed, Mar 24, 2010 at 2:36 PM, Guido van Rossum <guido at python.org> wrote:
> ..
>> Probably because we were blindly following the IEEE standard without
>> understanding it in every detail.
> Are you talking about "accidental" support for NaNs in older versions
> of Python or about recent efforts to support them properly in math and
> decimal modules?

My recollection include recent efforts, such as the math.isnan() function.

I don't recall ever hearing an argument for the peculiar behavior of
NaN in comparisons beyond "this is what the IEEE standard prescribes."

> I feel you are too harsh on the developers that worked in this area.

Maybe. I didn't mean to put down individuals complicit in the decision
-- in fact I would say that I am to blame myself for not probing

> I dare to suggest that the current situation is not due to lack of
> understanding of the standard, but due to pragmatic decisions made in
> early development and desire for backward compatibility in the recent
> versions.

I think that originally NaN (and Inf) behavior was so
platform-dependent that it really wouldn't have mattered if we had
changed it.

> Is this an area where design changes are feasible?  IIRC, NaN support
> was never "officially" in the language, but it may have changed with
> the decimal module.

It has been at least since 2.6 introduced math.isnan(), and ISTR there
was a proposal to add a separate module to deal with NaN and Inf
properly in a pure-python library module.

--Guido van Rossum (python.org/~guido)

More information about the Python-Dev mailing list