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

M.-A. Lemburg mal@lemburg.com
Wed, 16 Oct 2002 18:15:02 +0200


Guido van Rossum wrote:

So, apart from the Python 2.1 requirement, subclassing str does the trick, right?

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

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

Nevermind, I'll roll my own,

Marc-Andre Lemburg CEO eGenix.com Software GmbH


eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,... Python Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/