[Python-ideas] math.inf and math.nan constants
solipsis at pitrou.net
Wed Jan 7 16:03:08 CET 2015
On Wed, 7 Jan 2015 14:33:54 +0100
Todd <toddrjen at gmail.com> wrote:
> The current way to get infinite and nan floats are to do float("inf") and
> float("nan"), respectively. For many applications, this is sufficient.
> However, for scientific and mathematical computing, using inf and nan
> values is very common, and the current approach is very verbose. So for
> those applications, I think it would be useful if the math standard library
> module provided "math.nan" and "math.inf", which would return the same
> thing as float("nan") and float("inf"), respectively.
Note if you are using Numpy, you already have np.nan and np.inf.
More information about the Python-ideas