mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
more yield from
patch by Serhiy Storchaka
This commit is contained in:
parent
8bfcf51b5d
commit
fd0d3e5d25
5 changed files with 22 additions and 39 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue