Dr. Volker Jaenisch schrieb am 04.03.22 um 00:02:
Am 03.03.22 um 23:54 schrieb Stefan Behnel:
this reads like something you could implement on top of lxml.objectify,
via subclassing and an appropriate element class lookup.
This could really be a plain Python package that you could distribute on
PyPI to give users an easy choice which interface they prefer. Not
everything needs to be part of lxml itself.
My prototype is still clued to lxml since I use internal cython functions
of lxml that are not exported to python space. But with a little help of
the kind lxml people it may be possible to completely seperate it from lxml.
The idea is to do pretty much what objectify currently does, using (I
guess) the same element lookup, but to use a Python subclass of the
ObjectifiedElement class for the tree structure that implements your
different attribute lookup scheme in "__getattr__".
The general mechanism for selecting element class implementations is
described here:
https://lxml.de/element_classes.html
Stefan
_______________________________________________
lxml - The Python XML Toolkit mailing list -- lxml@python.org
To unsubscribe send an email to lxml-le...@python.org
https://mail.python.org/mailman3/lists/lxml.python.org/
Member address: arch...@mail-archive.com