[Python-Dev] Python and the Unicode Character Database

Antoine Pitrou solipsis at pitrou.net
Mon Nov 29 15:22:24 CET 2010


On Sun, 28 Nov 2010 21:32:15 -0500
Alexander Belopolsky <alexander.belopolsky at gmail.com> wrote:
> On Sun, Nov 28, 2010 at 6:43 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> ..
> >> is more important than to assure users that once their program
> >> accepted some text as a number, they can assume that the text is
> >> ASCII.
> >
> > Seems like a pretty foolish assumption, if you ask me, pretty much akin to
> > assuming that if string.isalpha() returns true that string is ASCII.
> >
> 
> It is not to 99.9% of Python users whose code is written for 2.x.
> Their strings are byte strings and string.isdigit() does imply ASCII
> even if string.isalpha() does not in many locales.

We are not talking about string.isdigit(), we are talking about the
float() constructor when given an unicode string.  Constructing a float
from an unicode string is certainly a common thing, even in 2.x.

Regards

Antoine.




More information about the Python-Dev mailing list