Deprecate public access to XMLWriter; simplify some attribute settings#31143
Deprecate public access to XMLWriter; simplify some attribute settings#31143QuLogic merged 1 commit intomatplotlib:mainfrom
Conversation
|
The existing signature matches https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element I think there is value in keeping that. |
|
I can choose to keep the old signature if you prefer, but what do you think about the call sites? (essentially, is |
|
I think Note: I assume that’s the intention of the ElementTree design: use attrib for more complex configuration and direct keywords as a convenience for very simple cases like |
|
Do you want to just close this, or are there still parts that you think are worth keeping? I'm fine either way. |
|
Making XMLWriter private is still reasonable. Choose yourself, whether closing+separate PR or force-pushing is simpler. |
|
Kept only the "Make XMLWriter private" part, plus converting a few attributes into direct kwargs (the hopefully uncontroversial ones, with no dict unpacking). |
|
Doc failure appears related: |
|
Hopefully fixed now. |
|
Sadly not, it seems. |
It is not necessary to put the attributes into a dict just to pass the dict to start() later; rather the attributes can be passed directly as kwargs to element(). Even in the case where the attributes are not valid identifiers one can use dict-unpacking to pass them.
This also allows removing the awkward
attrib={}mutable default on XMLWriter (#31141), and the (theoretical) impossibility of passing an attribute named "attrib" to start(). As this changes the API of XMLWriter, take that opportunity to make that helper class private (with deprecation).PR summary
PR checklist