One more thing I wanted to stress. Stefan Behnel wrote:
So, once you have understood that Elements can be part of different ElementTrees without loosing their global position in a document (which is basically how Fredrik's ElementTree works), it's even relatively obvious that there may be ancestors that are not part of the current ElementTree that is being worked on.
I forgot to stress that we *cannot* remove the restriction of Elements being only in a single *document* at a time, which ET does *not* enforce at all. This is the price we pay for using libxml and the reason why getparent() makes sense in lxml and not in ET. We can, however, remove the API divergence for Elements being in multiple ElementTrees - at the cost of making getparent() ignorant to ElementTrees. If compatibility with ET is the goal, I consider this the right trade-off. Stefan