[issue41892] use both "for in" and "ElementTree.remove" has a index bug

Eric V. Smith report at bugs.python.org
Wed Sep 30 10:31:44 EDT 2020


Eric V. Smith <eric at trueblade.com> added the comment:

I assume that ElementTree doesn't support mutation while iterating.

However, the docs at https://docs.python.org/3/library/xml.etree.elementtree.html#modifying-an-xml-file show removing an item while iterating. It probably only works because the child being removed is the last one.

----------
nosy: +eric.smith

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41892>
_______________________________________


More information about the Python-bugs-list mailing list