Message100342
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 :) |
|
Date |
User |
Action |
Args |
2010-03-03 13:44:42 | r.david.murray | set | recipients:
+ r.david.murray, effbot, scoder, flox |
2010-03-03 13:44:41 | r.david.murray | set | messageid: <1267623881.94.0.139641830562.issue8047@psf.upfronthosting.co.za> |
2010-03-03 13:44:40 | r.david.murray | link | issue8047 messages |
2010-03-03 13:44:39 | r.david.murray | create | |
|