from lxml import etree
root = etree.Element('root')
leaf = etree.SubElement(root, 'leaf')
leaf.append(root)
I wound up doing something like this in my program, with a thousand lines of code in between, so it was hard to figure out, and my code just started spinning, and I had no idea it was even spinning, I thought the code had finished.
Instead, why not throw an exception when someone does this, like you can't attach an element to itself?
Thanks!
Bradley Coleman