Mailing List Archive

cpython: use yield from
http://hg.python.org/cpython/rev/7c2df4af83dd
changeset: 76868:7c2df4af83dd
parent: 76865:a5a254e8a291
user: Benjamin Peterson <benjamin@python.org>
date: Thu May 10 16:17:35 2012 -0500
summary:
use yield from

files:
Lib/os.py | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)


diff --git a/Lib/os.py b/Lib/os.py
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -294,8 +294,7 @@
for name in dirs:
new_path = join(top, name)
if followlinks or not islink(new_path):
- for x in walk(new_path, topdown, onerror, followlinks):
- yield x
+ yield from walk(new_path, topdown, onerror, followlinks)
if not topdown:
yield top, dirs, nondirs

@@ -339,8 +338,7 @@
try:
if (followlinks or (st.S_ISDIR(orig_st.st_mode) and
path.samestat(orig_st, fstat(topfd)))):
- for x in _fwalk(topfd, top, topdown, onerror, followlinks):
- yield x
+ yield from _fwalk(topfd, top, topdown, onerror, followlinks)
finally:
close(topfd)

@@ -377,8 +375,7 @@
try:
if followlinks or path.samestat(orig_st, fstat(dirfd)):
dirpath = path.join(toppath, name)
- for x in _fwalk(dirfd, dirpath, topdown, onerror, followlinks):
- yield x
+ yield from _fwalk(dirfd, dirpath, topdown, onerror, followlinks)
finally:
close(dirfd)


--
Repository URL: http://hg.python.org/cpython