Message122625
| Author |
ezio.melotti |
| Recipients |
belopolsky, ezio.melotti, mark.dickinson, vstinner |
| Date |
2010年11月28日.04:29:32 |
| SpamBayes Score |
2.0044792e-05 |
| Marked as misclassified |
No |
| Message-id |
<1290918574.81.0.516337521387.issue10557@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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('1⁄2')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for float(): 1⁄2
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. |
|
History
|
|---|
| 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 |
|