[Python-ideas] [Python-Dev] Unicode minus sign in numeric conversions

Alexander Belopolsky alexander.belopolsky at gmail.com
Tue Jun 11 06:43:49 CEST 2013


On Mon, Jun 10, 2013 at 11:56 PM, Stephen J. Turnbull <stephen at xemacs.org>wrote:

> I don't see any compelling use case for builtins accepting
> any numerical syntax that can't be used in a Python program.
>

TOOWTDI

>>> float('٣')
3.0

Is the more obvious way to extract numeric value than

>>> unicodedata.numeric('٣')
3.0

> I'd move the current builtins to someplace like
> unicodedata.parsers.numeric.integer_insecure ..

That would be an overkill.  You can easily write safe code using
float(x.encode('ascii')), but if you remove non-ascii digits support from
float, there wont be an obvious way to parse non-ascii numerals.

I think we can drop support for mixed scripts, though.  It is hard to
justify accepting input that looks invalid to a human reader or worse is
interpreted by humans differently.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130611/20a40a23/attachment.html>


More information about the Python-ideas mailing list