R. David Murray <rdmur...@bitdance.com> added the comment:

I'm not an ElementTree user, but that spelling (etree.tostring(encode=str), or 
even etree.tostring(encode=unicode)) strikes me as horrible.  You don't encode 
to unicode, you *decode* to unicode.  Thus the current Python3 interface works 
the way I'd expect: if I don't specify an encoding, I get unicode.  If I do 
specify an encoding, I get encoded bytes.  In the general case the fact that 
you can no longer get away with being sloppy about what encoding a byte stream 
is in, the way you could in Python2, is a feature of Python3, not a bug.

If anything, having 'tostring' return bytes is broken, given its name.  But I 
think we fudge that by claiming it is returning a 'byte string' when given an 
encoding.

That said, I'm not sure how much, if at all, my opinion counts :)

----------
nosy: +effbot, flox, r.david.murray
priority:  -> normal

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8047>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to