Thanks Jon and Chris. But I'm not looking to make a literal_eval or custom
reprs that support inf and nan -- I may need that some day, so thanks for
the tips, but the idea here is to do that little bit more to make Python
better support the float special values out of the box.

It seems that moving math,inf and math.nan to __builtins__, and adding them
to a "whitelist" in literal_eval (and maybe another place or two?) would
accomplish this. Small benefit, yes, but I have yet to hear anyone present
a downside (other than the usual it's work that someone has to do).

I took another look at PEP 754 (which was rejected due to disinterest, not
because it was determined to be a bad idea), and note that the only part
that wasn't implemented was the creation of "constants" in __builtins__
(and, indeed, the PEP is not clear on whether it was suggesting that they
be in __builtins__ at all). The PEP also called for different names, and a
constant for negative Infinity, which doesn't seem very useful when you can
just use a negative sign.

Anyway, I'm done now -- there hasn't been any interest from core devs, and
I don't care enough to push this, but it would be nice.

-CHB


-- 
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/4VK6ND3GURQHSXZWHKBX43WOKOOUFRP5/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to