[Python-Dev] buffer('abc') == 'abc' is False ?!

Guido van Rossum guido@python.org
Wed, 16 Oct 2002 12:26:59 -0400


> >>Would be nice if there were a standard builtin, e.g. binary(),
> >>for this and maybe some support code to go with it in C (e.g.
> >>the type object would be nice to have at C level).
> > 
> > I disagree.  There are a thousand different applications, and yours
> > seems rather unusual to me.
> 
> It's not at all unusual if you interface to databases. These offer
> you three choices: character data, Unicode data and binary data
> and each of these is handled slightly differently.

I figure that most apps will be happy to return 8-bit strings for
binary data; that's what 8-bit strings were explicitly designed to
support.

> We currently don't have any notion of separating character data from
> binary except the difference between Unicode and strings. Using
> Unicode for character data only and reserving strings for
> binary data would be nice, except that practice shows that this
> doesn't always work because not all tools in the chain are
> ready for Unicode just yet (including Python's stdlib itself).

No, we'll eventually need a separate data type, but I doubt it needs
to be as compatible with the current 8-bit string type as your
requirements state.

> Nevermind, I'll roll my own,

You're welcome.

--Guido van Rossum (home page: http://www.python.org/~guido/)