[Python-Dev] just say no...
M.-A. Lemburg
mal@lemburg.com
Fri, 12 Nov 1999 16:17:43 +0100
Fredrik Lundh wrote:
>
> > > > Besides, the Unicode object will have a buffer containing the
> > > > <default encoding> representation of the object, which, if all goes
> > > > well, will always hold the UTF-8 value.
> > >
> > > <rant>
> > >
> > > over my dead body, that one...
> >
> > Such a buffer is needed to implement "s" and "s#" argument
> > parsing. It's a simple requirement to support those two
> > parsing markers -- there's not much to argue about, really...
>
> why? I don't understand why "s" and "s#" has
> to deal with encoding issues at all...
>
> > unless, of course, you want to give up Unicode object support
> > for all APIs using these parsers.
>
> hmm. maybe that's exactly what I want...
If we don't add that support, lot's of existing APIs won't
accept Unicode object instead of strings. While it could be
argued that automatic conversion to UTF-8 is not transparent
enough for the user, the other solution of using str(u)
everywhere would probably make writing Unicode-aware code a
rather clumsy task and introduce other pitfalls, since str(obj)
calls PyObject_Str() which also works on integers, floats,
etc.
--
Marc-Andre Lemburg
______________________________________________________________________
Y2000: 49 days left
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/