Author ezio.melotti
Recipients belopolsky, ezio.melotti, mark.dickinson, vstinner
Date 2010-11-28.04:29:32
SpamBayes Score 2.00448e-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('½')
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.
History
Date User Action Args
2010-11-28 04:29:34ezio.melottisetrecipients: + ezio.melotti, mark.dickinson, belopolsky, vstinner
2010-11-28 04:29:34ezio.melottisetmessageid: <1290918574.81.0.516337521387.issue10557@psf.upfronthosting.co.za>
2010-11-28 04:29:32ezio.melottilinkissue10557 messages
2010-11-28 04:29:32ezio.melotticreate