Message24482
Logged In: YES
user_id=311085
Bug should be marked INVALID.
childNodes lists are 'live'. You are iterating over a list
you are destroying at the same time. The code is equivalent
to the more obviously broken:
foo= [1, 2, 3, 4]
i= 0
while i<len(foo):
del foo[i]
i+= 1
foo
>>> [2, 4]
The 'working' example only works because it has extra
whitespace nodes in, so when you delete child number i, the
child i+1 that is skipped over is a Text node containing
only whitespace.
BTW, there's a separate bug tracker for the PyXML project
from which minidom is taken. You may get better results by
submitting there (and discussing on the XML-SIG list).
|
|
Date |
User |
Action |
Args |
2007-08-23 14:29:57 | admin | link | issue1157901 messages |
2007-08-23 14:29:57 | admin | create | |
|