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

Tim Peters tim_one@email.msn.com
Thu, 28 Sep 2000 18:48:08 -0400


[Tim]
> >>> 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

[MAL]
> Perhaps you should submit these for Unicode 4.0 ;-)

Note that the first two are already there; they just don't have an
associated numerical value.  The last one was a hint that I was trying to
write a frivolous msg while giving my "<wink>" key a break <wink>.

> 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 ...

Which is why I have to wonder whether there's *any* value in exposing the
numeric-value property beyond regular old digits.