[Python-Dev] Re: adding a bytes sequence type to Python

Guido van Rossum guido at python.org
Wed Aug 18 00:01:12 CEST 2004


> >> How would you embed raw bytes if the string was unicode?
> >
> > The most direct notation would be
> >
> >    bytes("delimited packet\x00")
> >
> > However, people might not understand what is happening, and
> > Guido doesn't like it if the bytes are >127.
> 
> I guess that was a bad example, what if the delimiter was \xff?  I know 
> that map(ord, u'delimited packet\xff') would get correct results.. but 
> I don't think I like that either.

Maybe the constructor could be bytes(<string>[, <encoding>])?

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


More information about the Python-Dev mailing list