Hi All,<br>Got a question:<br><br>I&#39;ve extended the ElementBase object using the approach described in the tutorial, but SubElement does not work as desired:<br><br>class NodeBase(etree.ElementBase):<br>&nbsp;&nbsp;&nbsp;&nbsp; def append(self,child):<br>

<div style="margin-left: 40px;">&nbsp;print &quot;aaa&quot;<br>&nbsp;return etree.ElementBase.append(self,child)<br></div><br>etree.SubElement(root,&quot;child&quot;) #no &quot;aaa&quot; printed<br><br>OK, but when taking your code to the module:<br>

<br>def SubElement(parent, tag, attrib={}, **extra):<br>&nbsp;&nbsp;&nbsp; attrib = attrib.copy()<br>&nbsp;&nbsp;&nbsp; attrib.update(extra)<br>&nbsp;&nbsp;&nbsp; element = parent.makeelement(tag, attrib)<br>&nbsp;&nbsp;&nbsp; parent.append(element)<br>&nbsp;&nbsp;&nbsp; return element <br><br>
SubElement(root,&quot;child&quot;) # &quot;aaa&quot; is here!<br>
<br>and overriding <br>&nbsp;&nbsp;&nbsp; def makeelement(self, tag, attrib):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return Node(tag, attrib)<br><br>in the NodeBase just does not help,<br><br>Any advice will be appreciated,<br>Alex