[Python-Dev] Python and the Unicode Character Database

Stephen J. Turnbull stephen at xemacs.org
Tue Nov 30 05:39:21 CET 2010


Steven D'Aprano writes:

 > But in any case, please don't conflate the question of whether Python 
 > should accept j and/or i for complex numbers with the question of 
 > supporting non-arabic numerals. The two issues are unrelated.

Different, yes, unrelated, no.  They're both about whether variant
forms of universally used literals should be allowed in a programming
language, or whether only the canonical form is allowed.  Note that
*nobody* is saying that Python should have no facility for parsing
these numbers, only that by default literal decimal numerals should be
encoded as ASCII digits.

For example, I would not object to int() getting a Boolean flag
meaning "consult unicodedata for non-ASCII digits", just as it has an
optional parameter meaning "decode in base other than 10".[1]  OTOH,
until somebody says "Yes, in Mecca the bazaar traders keep books on
their Lenovos using ISO-8859-6 numerals, and it would be painful for
them to switch to what we call 'Arabic' numerals", I'm going to
consider it a YAGNI.  Just as even though mathematicians clearly
prefer "i" as the imaginary unit, there's not enough pain involved in
them switching to "j" to make it worth supporting both.

(BTW, my first reaction to the "j" notation was "cool, Python supports
quaternions out of the box!"  It took only a second or so to return to
reality, but that was my first reaction.)


Footnotes: 
[1]  That might not be a good idea on other grounds, but in principle
I would be OK with such built-ins accepting non-ASCII digits on
request.




More information about the Python-Dev mailing list