This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scoder
Recipients effbot, eli.bendersky, mark, nikratio, scoder
Date 2014-01-20.08:02:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1390204956.09.0.451964216453.issue9521@psf.upfronthosting.co.za>
In-reply-to
Content
> As for backwards compatibility: yes, this is a concern. The keyword argument would be a solution. On the other hand, I'm not sure that the default should be something that causes dataloss...?

It's a matter of use cases. How often do people care? My experience tells me that it's much more common to parse XML in and extract information from it, than to do round trips. And when extracting information, both comments and processing instructions usually get in the way.

So I would say that this default behaviour isn't wrong. In fact, I'd even say that both lxml and ET behave as expected (or at least as intended) in their own ways.

Also, I can't really remember spotting a processing instruction anywhere *inside* of a root element in real world XML. For those living next to it, ET currently lacks support in its tree model.


> lxml sounds like it's doing the right things. Is there some connection between lxml and etree that I'm not aware of, or did you just give it as an example of how a different library behaves?

Both implement (essentially) the same API, so I consider compatibility and look-alikes important. The general idea is that lxml extends what's there, but otherwise tries to stay compatible as good as it can.

BTW, lxml also allows parser target objects to have "pi(self, target, data)" and "comment(text)" methods, through which it can pass comments and PIs through to user provided tree builders. I think ET lacks those, too.


Changing target version from 3.3/3.4 to 3.5 as this is a new feature that is unlikely to make it into a currently released (or close to release) Python version. Also changing the ticket type to enhancement as the current behaviour isn't "wrong". It's rather a matter of supporting an additional use case.
History
Date User Action Args
2014-01-20 08:02:36scodersetrecipients: + scoder, effbot, mark, eli.bendersky, nikratio
2014-01-20 08:02:36scodersetmessageid: <1390204956.09.0.451964216453.issue9521@psf.upfronthosting.co.za>
2014-01-20 08:02:36scoderlinkissue9521 messages
2014-01-20 08:02:35scodercreate