[Python-ideas] math.inf and math.nan constants

Guido van Rossum guido at python.org
Mon Jan 12 20:55:46 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.
>

Heh. I don't recall how that was decided. If you really want to know, try
tracking down the author (hg blame gives me unhelpfully that it was some
svn merge in 2008).

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150112/32603eb7/attachment.html>


More information about the Python-ideas mailing list