[Python-Dev] Unpickling py2 str as py3 bytes (and vice versa) (original) (raw)

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

Merlijn van Deen valhallasw at arctus.nl
Sat Mar 17 15:20:54 CET 2012


On 17 March 2012 10:43, Stefan Behnel <stefan_ml at behnel.de> wrote:

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.

That's this issue: http://bugs.python.org/issue8047

The thread also suggests the options encoding=False and encoding=None

Considering ET uses encoding="unicode" to signal 'don't encode', I agree with you that using encoding="bytes" to signal 'don't encode' would be sensible. However, ET /also/ allows encoding=str.What about allowing both encoding="bytes" /and/ encoding=bytes?

Best, Merlijn



More information about the Python-Dev mailing list