[Python-Dev] unifying str and unicode

Fredrik Lundh fredrik at pythonware.com
Mon Oct 3 21:47:19 CEST 2005


Antoine Pitrou wrote:

> > > If I have an unicode string containing legal characters greater than
> > > 0x7F, and I pass it to a function which converts it to str, the
> > > conversion fails.
> >
> > so?  if it does that, it's not unicode safe.
> [...]
> > what's that has to do with
> > my argument (which is that you can safely mix ascii strings and unicode
> > strings, because that's how things were designed).
>
> If that's how things were designed, then Python's entire standard
> brary (not to mention third-party libraries) is not "unicode safe" -
> to quote your own words - since many functions may return 8-bit strings
> containing non-ascii characters.

huh?  first you talk about functions that convert unicode strings to 8-bit
strings, now you talk about functions that return raw 8-bit strings?  and
all this in response to a post that argues that it's in fact a good idea to
use plain strings to hold textual data that happens to contain ASCII only,
because 1) it works, by design, and 2) it's almost always more efficient.

if you don't know what your own argument is, you cannot expect anyone
to understand it.

</F>





More information about the Python-Dev mailing list