summaryrefslogtreecommitdiffstats
path: root/Lib/os.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-05-10 21:17:35 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-05-10 21:17:35 (GMT)
commit569d0875741df1ab196531fb4098b5e5e640aa61 (patch)
treeae07beb18fb9ff9e921976bc1287f5da9ebc8305 /Lib/os.py
parente8751e05d92e2b001b13729dfbe6dd18791de67b (diff)
downloadcpython-569d0875741df1ab196531fb4098b5e5e640aa61.zip
cpython-569d0875741df1ab196531fb4098b5e5e640aa61.tar.gz
cpython-569d0875741df1ab196531fb4098b5e5e640aa61.tar.bz2
use yield from
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/Lib/os.py b/Lib/os.py
index 2c7d954..ed2a31e 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -294,8 +294,7 @@ def walk(top, topdown=True, onerror=None, followlinks=False):
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 @@ if _exists("openat"):
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 @@ if _exists("openat"):
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)