Deprecate bool(Element)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
Triaged
|
Medium
|
scoder |
Bug Description
Currently, using an Element in a boolean context e.g.
if Element('a'):
triggers a FutureWarning, matching elementtree, sort-of: in the standard library the warning was emitted by the Python implementation but not the accelerated C implementation.
https:/
Maybe lxml could be updated to do the same?
I noticed that you'd participated in the original discussion and had explained the issue at the root of the warning, but I don't know if you followed closely, 5.2 still uses the FutureWarning, the 5.3 changelog makes no mention of it, and I found no mention of this change on either here or github.
Also discussions on the future of Element.__bool__ (wether to return a constant `True` or raise) are at https:/ /github. com/python/ cpython/ issues/ 119577
I would assume your input would be appreciated as I believe lxml to be a pretty massively used provider of the ElementTree API.