[issue27412] float('∞') returns 8.0
Eryk Sun
report at bugs.python.org
Wed Jun 29 07:47:28 EDT 2016
Eryk Sun added the comment:
There's something wrong with however you're testing this.
>>> s = '\N{infinity}'
>>> s == '∞' == '\u221e'
True
'∞' isn't numeric. It's a math symbol (Sm):
>>> unicodedata.category(s)
'Sm'
>>> s.isdecimal()
False
>>> s.isdigit()
False
So float('∞') should raise a ValueError:
>>> float(s)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: could not convert string to float: '∞'
----------
nosy: +eryksun
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27412>
_______________________________________
More information about the Python-bugs-list
mailing list