[proxy] github.com← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light
/ cpython Public

Conversation

Copy link
Contributor

mcepl commented Aug 25, 2018

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

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.
Copy link
Contributor Author

mcepl commented Aug 25, 2018

@scoder, what do you think?

enc_lower = encoding.lower()

if pretty_print:
self._indent(self._root)
Copy link
Contributor

scoder Aug 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

scoder commented Apr 14, 2019

Rejecting this PR in its current form, because it adds a side-effect to an otherwise pure output function.

scoder closed this Apr 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants