On 8/24/07, Greg Ewing <[EMAIL PROTECTED]> wrote:
> Guido van Rossum wrote:
> > there's collusion between the bytes and unicode
> > types so that this works:
> >
> >   b = b"abc"
> >   b[1:2] = "X"
>
> Is this intentional? Doesn't it run counter to the idea
> that text and bytes should be clearly separated?

Sorry, I wasn't clear. I was describing the status quo, which I am as
unhappy about as you are.

> > Unfortunately taking the buffer API away from unicode makes things
> > fail early
>
> If the buffer API distinguishes between text and binary
> buffers, then the binary streams can just accept binary
> buffers only, and unicode can keep its buffer API.

Yes, but the bytes object is the one doing the work, and for some
reason that I don't yet fathom it asks for character buffers. Probably
because there are tons of places where str and bytes are still being
mixed. :-(

I tried to change the bytes constructor so that bytes(s) is invalid if
isinstance(s, str), forcing one to use bytes(s, <encoding>). This
caused many failures, some of which I could fix, others which seem to
hinge on a fundamental problem (asserting that bytes objects support
the string API).

More work to do... :-(

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to