[Python-checkins] r76429 - python/trunk/Lib/os.py
benjamin.peterson
python-checkins at python.org
Fri Nov 20 03:56:43 CET 2009
Author: benjamin.peterson
Date: Fri Nov 20 03:56:43 2009
New Revision: 76429
Log:
avoid function import
Modified:
python/trunk/Lib/os.py
Modified: python/trunk/Lib/os.py
==============================================================================
--- python/trunk/Lib/os.py (original)
+++ python/trunk/Lib/os.py Fri Nov 20 03:56:43 2009
@@ -263,7 +263,7 @@
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 @@
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
More information about the Python-checkins
mailing list