[Python-ideas] math.inf and math.nan constants
Devin Jeanpierre
jeanpierreda at gmail.com
Tue Jan 13 00:39:11 CET 2015
On Mon, Jan 12, 2015 at 11:40 AM, Zachary Ware
<zachary.ware+pyideas at gmail.com> wrote:
> On Mon, Jan 12, 2015 at 1:33 PM, MRAB <python at mrabarnett.plus.com> wrote:
>> I was going to say that calling it "isnan" is in keeping with
>> "isdigit", etc, but those are instance methods!
>>
>> So, why is it "math.isnan(x)" and not "x.isnan()"?
>
> I'm a little curious about this myself, since float.is_nan(),
> float.is_inf(), and float.is_finite() are all implemented, but #if 0'd
> out.
I'm not Christian, but adding methods to numbers can be annoying
because you may also have to add it to ints, rationals, decimals, the
numeric ABCs... At the very least, to ints, anyway.
-- Devin
More information about the Python-ideas
mailing list