Skip to content Skip to sidebar Skip to footer

How To Inherit Elementtree.element Class In Python?

I try to define a NewElement class, which inherit ElementTree.Element. The goal is adding a few more methods, e.g. foo1(), foo2(), to it. Define NewElement class: import xml.e

Solution 1:

It's unnecessary to do so. Simply make foo1 foo2 module level functions which accept instances of Element and return the instances:

foo2(foo1(a_element))

Post a Comment for "How To Inherit Elementtree.element Class In Python?"