[Python-ideas] math.inf and math.nan constants
Ethan Furman
ethan at stoneleaf.us
Wed Jan 7 20:49:37 CET 2015
On 01/07/2015 11:02 AM, Bruce Leban wrote:
>
> There is a problem here but that's not it. The problem is that
>
> float("nan") is float("nan") => False
> math.nan is math.nan => True
This is not a new problem:
--> nan = float('nan')
--> nan is nan
True
> So is this an attractive nuisance that will make people think they can should use x is math.nan instead of
> math.isnan(x)? Hopefully not but something to consider. Pylint should flag this usage.
Agreed, for all linters.
--
~Ethan~
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150107/90ebbfd4/attachment.sig>
More information about the Python-ideas
mailing list