more yield from

patch by Serhiy Storchaka
This commit is contained in:
Philip Jenvey 2012-10-01 15:34:31 -07:00
parent 8bfcf51b5d
commit fd0d3e5d25
5 changed files with 22 additions and 39 deletions

View file

@ -459,8 +459,7 @@ class Element:
if tag is None or self.tag == tag:
yield self
for e in self._children:
for e in e.iter(tag):
yield e
yield from e.iter(tag)
# compatibility
def getiterator(self, tag=None):
@ -487,8 +486,7 @@ class Element:
if self.text:
yield self.text
for e in self:
for s in e.itertext():
yield s
yield from e.itertext()
if e.tail:
yield e.tail