[Python-Dev] unicodedata.numeric (was RE: stupid floating point question...)

M.-A. Lemburg mal@lemburg.com
Fri, 29 Sep 2000 00:33:50 +0200


Tim Peters wrote:
> 
> [tim]
> > leaving-it-up-to-/f-to-decide-what-.rational()-should-return-for-pi-
> >     ly y'ts  - the timmy of death
> 
> [/F]
> > oh, the unicode folks have figured that one out:
> >
> > >>> unicodedata.numeric(u"\N{GREEK PI SYMBOL}")
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in ?
> > ValueError: not a numeric character
> 
> Ya, except I'm starting to suspect they're not floating-point experts
> either:
> 
> >>> unicodedata.numeric(u"\N{PLANCK CONSTANT OVER TWO PI}")
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ValueError: not a numeric character
> >>> unicodedata.numeric(u"\N{EULER CONSTANT}")
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ValueError: not a numeric character
> >>> unicodedata.numeric(u"\N{AIRSPEED OF AFRICAN SWALLOW}")
> UnicodeError: Unicode-Escape decoding error: Invalid Unicode Character Name
> >>>

Perhaps you should submit these for Unicode 4.0 ;-)

But really, I don't suspect that anyone is going to do serious
character to number conversion on these esoteric characters. Plain
old digits will do just as they always have (or does anyone know
of ways to represent irrational numbers on PCs by other means than
an algorithm which spits out new digits every now and then ?).

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/