Stefan Behnel <sco...@users.sourceforge.net> added the comment:

Antoine, in the same comment, you say that it was not backported to Py2 in 
order to prevent breaking existing code, and then you ask if it's difficult to 
support in lxml. ;-)

Supporting the same behaviour in lxml would either mean that it breaks existing 
code in Py2 (when making the API consistent), or that you can safely (and 
correctly) write the return value to a file in Py2, but that you can't do the 
same in Py3 (when adopting the change only in Py3).

Previously, in ElementTree, serialising without an explicit encoding was a way 
to get a byte encoded serialisation without an XML declaration header, so I 
expect there to be code that depends on this. Since ElementTree 1.3 uses the 
same keyword argument as lxml for this feature, I assume that Florent's patches 
provide at least an alternative here, even if it requires users to adapt their 
code.

I just wish this backwards incompatible feature had been advertised at the 
time, or at least *documented* in any way. Even the latest 3.2-dev docs still 
state that the default encoding of the serialiser is US-ASCII, not a word about 
*ever* returning a unicode string, especially not by default, and totally not 
the required big fat warning that writing to a file will fail with mysterious 
errors if no encoding is specified.

----------

_______________________________________
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