summaryrefslogtreecommitdiffstats
path: root/Lib/os.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-11-20 02:56:43 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-11-20 02:56:43 (GMT)
commit246ec332fda2b8bbd6e6b4335cd540db5238698d (patch)
tree6c7e80bd253083844a718c22274f1663fd499f3d /Lib/os.py
parentcef9782810ab6b4e271d55633e8d766525b9d673 (diff)
downloadcpython-246ec332fda2b8bbd6e6b4335cd540db5238698d.zip
cpython-246ec332fda2b8bbd6e6b4335cd540db5238698d.tar.gz
cpython-246ec332fda2b8bbd6e6b4335cd540db5238698d.tar.bz2
avoid doing an uneeded import in a function
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/os.py b/Lib/os.py
index c41af1a..e8a0113 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -263,7 +263,7 @@ def walk(top, topdown=True, onerror=None, followlinks=False):
dirs.remove('CVS') # don't visit CVS directories
"""
- from os.path import join, isdir, islink
+ islink, join, isdir = path.islink, path.join, path.isdir
# We may not have read permission for top, in which case we can't
# get a list of the files the directory contains. os.path.walk
@@ -289,9 +289,9 @@ def walk(top, topdown=True, onerror=None, followlinks=False):
if topdown:
yield top, dirs, nondirs
for name in dirs:
- path = join(top, name)
- if followlinks or not islink(path):
- for x in walk(path, topdown, onerror, followlinks):
+ new_path = join(top, name)
+ if followlinks or not islink(new_path):
+ for x in walk(new_path, topdown, onerror, followlinks):
yield x
if not topdown:
yield top, dirs, nondirs