[issue3008] Let bin/oct/hex show floats
Mark Dickinson
report at bugs.python.org
Sat Jul 12 09:13:28 CEST 2008
Mark Dickinson <dickinsm at gmail.com> added the comment:
Here's an updated patch that makes the trailing 'p123' exponent optional
in fromhex. (This matches the behaviour of C99's strtod and sscanf; in
contrast, Java always requires the exponent.)
I'm beginning to wonder whether the '0x' shouldn't also be optional on
input as well, in the same way that it's optional in int():
>>> int('0x45', 16)
69
>>> int('45', 16)
69
This would then allow, e.g.,
>>> float.fromhex('45')
69.0
Added file: http://bugs.python.org/file10881/hex_float6.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3008>
_______________________________________
More information about the Python-bugs-list
mailing list