Closed jkhsjdhjs closed 4 months ago
So you're saying that by default, every user of lxml
should access the internal class etree._Element
?
That seems weird to me.
Every user of lxml is implicitly working with _Element
, as Element
is just a factory function that returns _Element
instances. It's also a bit weird to me, but that's the way it is implemented.
Okay, then I'm fine that we use etree._Element
for the type annotation, as long as we still call etree.Element()
to instantiate.
lxml
provides type annotations via thelxml-stubs
package. By using this package, we don't need thetype: ignore
comments when importinglxml
anymore. Furthermore, the typehints are adjusted:etree.Element
is only a factory function that createsetree._Element
instances.Finally, when generating the docs we introduced a workaround that makes linking to the
lxml
documentation possible. Since it only replaced lookups forElement
with_Element
, it isn't necessary anymore and removed.