This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients mark.dickinson, steven.daprano
Date 2016-09-06.17:47:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20160906174711.GZ26300@ando.pearwood.info>
In-reply-to <1473182673.74.0.140845727903.issue27975@psf.upfronthosting.co.za>
Content
As a convenience for whom? Certainly not the poor user, who thinks that 
math.isnan(x) should return False if the number x is not a NAN. Since 
neither 10**1 nor 10**100000 are NANs, why should one return correctly 
and the other raise a completely spurious OverflowError?

I cannot speak for the implementation, except as a wild guess. It 
shouldn't be hard to do the equivalent of:

if type(x) == int: return False  # Intentionally excluding subclasses.
try:
    y = float(x)
except OverflowError:
    return False
else:
    ... # existing implementation

but since I know nothing about the C implementation maybe I'm completely 
wrong. But as far as the user's cognitive load, I don't think that:

"math.isnan(x) might return the expected result, or it might raise 
OverflowError"

is *simpler* for the user than:

"math.isnan(x) will return the expected result".
History
Date User Action Args
2016-09-06 17:47:18steven.dapranosetrecipients: + steven.daprano, mark.dickinson
2016-09-06 17:47:18steven.dapranolinkissue27975 messages
2016-09-06 17:47:18steven.dapranocreate