Message122625
I think float() should support non-ascii digits but I agree that it would be better to avoid UnicodeErrors and convert them to ValueErrors so that
>>> float('١٢٣٤.٥٦')
1234.56
and
>>> float('½')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for float(): ½
I.e. float should do the C equivalent of:
try:
s = arg.encode('decimal')
except UnicodeEncodeError:
raise ValueError('Invalid liter for float(): {}'.format(arg))
Note that int() and Decimal() supports non-ascii chars too. |
|
Date |
User |
Action |
Args |
2010-11-28 04:29:34 | ezio.melotti | set | recipients:
+ ezio.melotti, mark.dickinson, belopolsky, vstinner |
2010-11-28 04:29:34 | ezio.melotti | set | messageid: <1290918574.81.0.516337521387.issue10557@psf.upfronthosting.co.za> |
2010-11-28 04:29:32 | ezio.melotti | link | issue10557 messages |
2010-11-28 04:29:32 | ezio.melotti | create | |
|