[Python-Dev] Unpickling py2 str as py3 bytes (and vice versa) - implementation (issue #6784)

Stefan Behnel stefan_ml at behnel.de
Sat Mar 17 10:43:43 CET 2012


Guido van Rossum, 17.03.2012 00:57:
> OK, how about using encoding=bytes (yes, the type object!)? Or 'bytes' ?

In lxml, there was an "encoding=unicode" option that would let the
XML/HTML/text serialisation function return a Unicode string. This was
eventually deprecated in favour of "encoding='unicode'" when ElementTree
gained this feature as well some years later. Arguably, this was because
there no longer was a unicode type in the then existing Py3, but ...

Anyway, given that there is at least some precedence, I'd prefer the name
"bytes" over the bare bytes type. Regarding possible naming conflicts, I
don't see any sense in calling an actual encoding "bytes" that does
anything but returning bare bytes in a bytes object, as is the case here.

Stefan



More information about the Python-Dev mailing list