from lxml import etree
element1 = etree.Element('{j:a}a', nsmap={None: 'j:a'})
etree.SubElement(element1, 'b')
element2 = etree.Element('{j:a}a', nsmap={None: 'j:a'})
etree.SubElement(element2, '{j:a}b')
both elements serialise to the same
<a xmlns="j:a"><b/></a>
but both elements do not behave the same
element1.find('b') -> returns the Element
element2.find('b') -> returns None
if you do it the other way around
etree.fromstring("<a xmlns="j:a"><b/></a>")
you get the representation from element2, so
element2.find('b') -> returns None
which seems consistent because there is no namespaceless <b/> in the tree, because <b/> inherits the default namespace from <a/>
so what's the purpose of the representation in element1? It seems to add a namespaceless subelement <b/> and behaves that way. But when serialised the element inherits from <a>.
Why does this exist if it does not serialise anyway?