[Python-Dev] Weekly Python Bug/Patch Summary

Michael Hudson mwh at python.net
Thu Feb 19 14:17:44 EST 2004


"Tim Peters" <tim.one at comcast.net> writes:

> [Michael Hudson]
>>>> Would it make (more) sense to implement rich comparisons for floats?
>
> [Tim]
>>> Not much.
>
> [Michael]
>> But a little bit?  It might at least make the results closer to what
>> the underlying C compiler does (modulo bugs in same, of course).
>
> The intended behavior of NaNs is covered precisely by standards.  Moving
> Python's nonsense behavior closer to the platform C's nonsense behavior
> doesn't scream "useful" to me. 

As you say below, it helps with gcc (which more-or-less claims C99
support of late, so no great surprise).

> But I don't object to it either, if someone can't think of something
> better to do with their time <wink>.

Heh.  See the patch I just attached to the report :-)

> At least gcc users would get something much closer to what the
> standard intends (although their Python wouldn't be portable in
> these respects).  OTOH, by pure accident, NaN==NaN *happens* to
> return the intended False today under Windows Python, and if that's
> changed, via rich comparison, to return True (which MSVC returns for
> the C expression NaN==NaN), then we've also managed to break
> currently-working code on Windows.

Is MSVC 7 any different here?  I did try to poke around
msdn.microsoft.com and found:

    This version of Visual C++ is not conformant with the C99
    standard.

which (a) was in a section about the library specifically and (b)
doesn't answer the question.  Oh, hang on:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndeepc/html/deep05282002.asp

suggests (very much) that this *has* changed.  But "someone" should
check (I can't).

(I certainly wasn't proposing this change for release23-maint).

> 754 really isn't friendly to half-assed support.

Indeed.  But I think were the underlying compiler implements C99
semantics, it's unfriendly of Python to hide them.

Cheers,
mwh

-- 
  Ignoring the rules in the FAQ: 1" slice in spleen and prevention 
    of immediate medical care.
                                              -- Mark C. Langston, asr



More information about the Python-Dev mailing list