diff options
author | Philip Jenvey <pjenvey@underboss.org> | 2012-10-01 22:34:31 (GMT) |
---|---|---|
committer | Philip Jenvey <pjenvey@underboss.org> | 2012-10-01 22:34:31 (GMT) |
commit | fd0d3e5d25cf9dcb751a329cf390388e0dbd8da2 (patch) | |
tree | 2a0f83ce2ce3a894d27a6330ecb731bb0fc6fc76 /Lib/xml | |
parent | 8bfcf51b5d0ca5a0bbd7045c318f5aa31e5f7de8 (diff) | |
download | cpython-fd0d3e5d25cf9dcb751a329cf390388e0dbd8da2.zip cpython-fd0d3e5d25cf9dcb751a329cf390388e0dbd8da2.tar.gz cpython-fd0d3e5d25cf9dcb751a329cf390388e0dbd8da2.tar.bz2 |
more yield from
patch by Serhiy Storchaka
Diffstat (limited to 'Lib/xml')
-rw-r--r-- | Lib/xml/etree/ElementPath.py | 6 | ||||
-rw-r--r-- | Lib/xml/etree/ElementTree.py | 6 |
2 files changed, 4 insertions, 8 deletions
diff --git a/Lib/xml/etree/ElementPath.py b/Lib/xml/etree/ElementPath.py index 52e65f0..341dac0 100644 --- a/Lib/xml/etree/ElementPath.py +++ b/Lib/xml/etree/ElementPath.py @@ -105,14 +105,12 @@ def prepare_child(next, token): def prepare_star(next, token): def select(context, result): for elem in result: - for e in elem: - yield e + yield from elem return select def prepare_self(next, token): def select(context, result): - for elem in result: - yield elem + yield from result return select def prepare_descendant(next, token): diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py index b9d8df6..c199b17 100644 --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -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 |