Fredrik Lundh <fred...@effbot.org> added the comment:

Footnote: "iterparse" does things this way mostly to keep the implementation 
simple and fast; due to buffering, the tree builder are usually ahead of the 
event generation with up to 16k.  See the note on this page:

http://effbot.org/zone/element-iterparse.htm

and the message it links to for more on this topic.

Your case is a very common use case for "tostring", so it would probably have 
made sense to make "tostring" skip the tail on the element itself, at least if 
it's whitespace only.  Guess we could add an option...

But in your case, you can probably just nuke or normalize the "tail" element 
before writing it out (i.e. set it to None or "\n").

----------

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

Reply via email to