summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/btm_utils.py
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2012-10-06 14:11:45 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2012-10-06 14:11:45 (GMT)
commit7d14015e629da702f17d5e0ab616c15c8145e771 (patch)
treec4905ff89a2d5c64486a6ffdeddc5ae74cf848ae /Lib/lib2to3/btm_utils.py
parentc018f57186bed05a129a0eda5d9ae11d94da5189 (diff)
downloadcpython-7d14015e629da702f17d5e0ab616c15c8145e771.zip
cpython-7d14015e629da702f17d5e0ab616c15c8145e771.tar.gz
cpython-7d14015e629da702f17d5e0ab616c15c8145e771.tar.bz2
Issue #16120: Use |yield from| in stdlib.
Patch by Berker Peksag.
Diffstat (limited to 'Lib/lib2to3/btm_utils.py')
-rw-r--r--Lib/lib2to3/btm_utils.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/lib2to3/btm_utils.py b/Lib/lib2to3/btm_utils.py
index 2276dc9..339750e 100644
--- a/Lib/lib2to3/btm_utils.py
+++ b/Lib/lib2to3/btm_utils.py
@@ -96,8 +96,7 @@ class MinNode(object):
def leaves(self):
"Generator that returns the leaves of the tree"
for child in self.children:
- for x in child.leaves():
- yield x
+ yield from child.leaves()
if not self.children:
yield self
@@ -277,7 +276,6 @@ def rec_test(sequence, test_func):
sub-iterables"""
for x in sequence:
if isinstance(x, (list, tuple)):
- for y in rec_test(x, test_func):
- yield y
+ yield from rec_test(x, test_func)
else:
yield test_func(x)