Comparing to the solution suggested in #4016, this should bear no performance penalty when pretty_print=False (which is the default). On the other hand, it is not suitable for processing of large XML data. Then some alternative solution (e.g., lxml module) must be used.
|
@scoder, what do you think? |
| enc_lower = encoding.lower() | ||
|
|
||
| if pretty_print: | ||
| self._indent(self._root) |
There was a problem hiding this comment.
Sorry, but write() is an output method. It shouldn't have side-effects that change the tree.
Just imagine you'd print or log the tree for debugging purposes and it would alter the serialised result later on.
|
Rejecting this PR in its current form, because it adds a side-effect to an otherwise pure output function. |
Comparing to the solution suggested in #4016, this should bear no performance penalty when pretty_print=False (which is the default). On the other hand, it is not suitable for processing of large XML data. Then some alternative solution (e.g., lxml module) must be used.
https://bugs.python.org/issue14465