2017-09-12 1:27 GMT+02:00 Neil Schemenauer <[email protected]>:
>> k = float("0x1.2492492492492p-3") # 1/7
>
> Making it a different function from float() would avoid backwards
> compatibility issues. I.e. float() no longer returns errors on some
> inputs.
In that case, I suggest float.fromhex() to remain consistent the bytes example:
>>> b'123'.hex()
'313233'
>>> bytes.fromhex('313233')
b'123'
... Oh wait, it already exists...
>>> float.fromhex('0x1.921fb54442d18p+1')
3.141592653589793
:-D
Victor
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/