[Python-Dev] Python and the Unicode Character Database
Steven D'Aprano
steve at pearwood.info
Tue Nov 30 13:59:49 CET 2010
haiyang kang wrote:
> hi,
>
> I agree with this.
>
> I never seen any man in China using chinese number literals (at
> least two kinds:一, 壹, same meaning with 1)
> in Python program, except UI output.
>
> They can do some mappings when want to output these non-ascii numbers.
> Example: if 1: print "一"
>
> I think it is a little ugly to have code like this: num =
> float("一.一"), expected result is: num = 1.1
I don't expect that anyone would sensibly write code like that, except
for testing. You wouldn't write num = float("1.1") instead of just
num = 1.1 either.
But you should be able to write:
text = input("Enter a number using your preferred digits: ")
num = float(text)
without caring whether the user enters 一.一 or 1.1 or something else.
--
Steven
More information about the Python-Dev
mailing list