[Python-Dev] Python 3.x and bytes

Greg Ewing greg.ewing at canterbury.ac.nz
Wed May 18 07:43:37 CEST 2011

Robert Collins wrote:
> urlparse converting bytes to 'str' to operate on them is
> at best a kludge - you're forcing 5 times the storage (the original
> bytes + 4 bytes-per-byte when its decoded into unicode)

That is itself an implementation detail of current Python,
though, due to it only having one internal representation of

In principle there could be a form of str that keeps its
data encoded in latin1, in which case constructing it from
a byte string could simply involve storing a pointer to the
original bytes data.


More information about the Python-Dev mailing list