This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author milko.krachounov
Recipients MLModel, effbot, georg.brandl, milko.krachounov
Date 2009-12-05.13:19:10
SpamBayes Score 3.189071e-09
Marked as misclassified No
Message-id <1260019152.96.0.545653706639.issue6472@psf.upfronthosting.co.za>
In-reply-to
Content
This isn't just a documentation issue. A function named getiterator(),
for which the docs say that it returns an iterator, should return an
iterator, not just an iterable. They have different semantics and can't
be used interchangeably, so the behaviour of getiterator() in
ElementTree is wrong. I was using this in my program:

iterator = element.getiterator()
next(iterator)
subelement = next(iterator)

Which broke when I tried switching to ElementTree from cElementTree,
even though the docs tell me that I'll get an iterator there.

Also, for findall() and friends, is there any reason why we can't stick
to either an iterator or list, and not both? The API will be more clear
if findall() always returned a list, or always an iterator, regardless
of the implementation. It is currently not clear what will happen if I do:

for x in tree.findall(path):
     mutate_tree(tree, x)
History
Date User Action Args
2009-12-05 13:19:13milko.krachounovsetrecipients: + milko.krachounov, effbot, georg.brandl, MLModel
2009-12-05 13:19:12milko.krachounovsetmessageid: <1260019152.96.0.545653706639.issue6472@psf.upfronthosting.co.za>
2009-12-05 13:19:11milko.krachounovlinkissue6472 messages
2009-12-05 13:19:10milko.krachounovcreate