[Python-Dev] Python and the Unicode Character Database

Steven D'Aprano steve at pearwood.info
Mon Nov 29 23:09:15 CET 2010


Alexander Belopolsky wrote:

> Speaking of YAGNI, does anyone want to defend
> 
>>>> complex('١٢٣٤.٥٦j')
> 1234.56j

*If* we allow float('١٢٣٤.٥٦') (as we currently do, but is being 
disputed by some), then we should allow complex('١٢٣٤.٥٦j'). It would be 
silly for complex to be more restrictive than float.


> Especially given that we reject complex('1234.56i'):

I don't understand why you use 'i' when Python uses 'j' as the symbol 
for imaginary numbers.

 >>> complex('1234.56j')
1234.56j

works fine. I have no problem with Python choosing one of i/j as the 
symbol for imaginary-1 and rejecting the other. I prefer i rather than 
j, but that's because my background is in maths rather than electrical 
engineering, but I can live with either.

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.



-- 
Steven



More information about the Python-Dev mailing list