Hi Burak and Holger, thank you both a lot for the good pointers and explanations. It definitely helps, and I'll need some time to dig into. Am 09.02.2022 19:28 schrieb jholg@gmx.de:
Since a namedtuple is still a tuple this would trigger special-cased sequence assignment
namedtuple was contrived, in practice types it's more about nested classes.
I'd probably forgo all this and simply use the glorious E-Factory to create structured data in assignments where needed
Tried E and am quite happy. Just discovered it automatically ignores None arguments - that's very useful when python types have lot's of optional attributes. Now I can simply write something like this element = E.structured( E.a(mytype.a) if mytype.a else None, E.b(mytype.b) if mytype.b else None, ) One new question: Is it possible to enforce an XSD type when using E-Factories? Like in this again imaginary mini-DSL approach ITEM_DATE = E(xsi_type="dateTime").item_date ITEM_DATE(datetime.datetime.now()) # works, uses previously registered custom objectify.PyType without guessing ITEM_DATE("foo") # raises Exception because value can't be converted to xsd:dateTime Cheers Tobias