[Python-ideas] Hexadecimal floating literals

Victor Stinner victor.stinner at gmail.com
Mon Sep 11 18:45:37 EDT 2017

Instead of modifying the Python grammar, the alternative is to enhance
float(str) to support it:

k = float("0x1.2492492492492p-3") # 1/7


2017-09-08 8:57 GMT+02:00 Serhiy Storchaka <storchaka at gmail.com>:
> The support of hexadecimal floating literals (like 0xC.68p+2) is included in
> just released C++17 standard. Seems this becomes a mainstream.
> In Python float.hex() returns hexadecimal string representation. Is it a
> time to add more support of hexadecimal floating literals? Accept them in
> float constructor and in Python parser? And maybe add support of hexadecimal
> formatting ('%x' and '{:x}')?
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/

More information about the Python-ideas mailing list