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

Stephen J. Turnbull stephen at xemacs.org
Sun Jun 9 18:13:20 CEST 2013


Steven D'Aprano writes:

 > > But Python goes much farther.  float('٢.๑') also returns 2.1 (not to
 > > mention that int('٢๑') returns 21).
 > 
 > Yes. And why is this a problem? There is no ambiguity. It might
 > look untidy to be mixing Arab and Thai numerals in the same number,
 > but it is still well-defined.

To whom?  Unicode didacts, maybe, but I doubt there are any real users
who would consider that well-defined.  So the same arguments you made
for not permitting non-ASCII numerals in Python source code apply
here, although they are somewhat weaker when applied to numeric data
expressed as text.

In any case, there's not really that much use for this generality of
numerals.  On the one hand, I think these days anyone who uses
information technology is fluent in ASCII numeration.  On the other,
if you want to allow people to write in other scripts, you probably
are dealing with "naive" users who should be allowed to use grouping
characters and the usual conventions for their locale, and int () and
float() just aren't good enough anyway.



More information about the Python-ideas mailing list