[Python-ideas] math.inf and math.nan constants
Todd
toddrjen at gmail.com
Wed Jan 7 15:58:37 CET 2015
Yes, this would be a shortcut for that. math.nan and math.inf are less
verbose than float("nan") and float("inf"), even if you aren't already
using the math module (fewer characters total, and in particular fewer
special characters). It would also, at least in my opinion, be more
readable. Plus there is already the math.isnan and math.isinf, so I don't
think it would be totally out-of-place.
On Wed, Jan 7, 2015 at 2:49 PM, Mark Young <marky1991 at gmail.com> wrote:
> So with the proposal, you'd likely do something like
>
> from math import nan, inf
>
> Couldn't you just instead put
>
> nan, inf = float("nan"), float("inf")
>
> at the top of your script? I don't really think this is any more verbose
> than an import from the math module. (Unless you're already doing an import
> star from math)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150107/dc15c470/attachment-0001.html>
More information about the Python-ideas
mailing list