Skip to content

Instantly share code, notes, and snippets.

Still on the left!!!

Column1 Column1 Column1
Column1 Column1 Column1
from xml.etree import ElementTree as etree
class _ElementInterface(etree._ElementInterface):
""" Add a 'parent' property to ElementTree Elements. Defaults to None. """
parent = None
etree._ElementInterface = _ElementInterface
def SubElement(parent, tag, attrib={}, **extra):
""" Replace SubElement factory func with one that also sets an Element's parent. """