]> granicus.if.org Git - python/commitdiff
Avoid using 'dir' as a variable name and use os.path.join() to create
authorSkip Montanaro <skip@pobox.com>
Thu, 19 Jun 2003 18:10:37 +0000 (18:10 +0000)
committerSkip Montanaro <skip@pobox.com>
Thu, 19 Jun 2003 18:10:37 +0000 (18:10 +0000)
paths.

Doc/lib/libstat.tex

index acad5e07760b0c570f526251862a6ea2c4afadf7..74ccc3777be15b41c7bed9f5fa85f5cb09c11f54 100644 (file)
@@ -129,12 +129,12 @@ Example:
 import os, sys
 from stat import *
 
-def walktree(dir, callback):
-    '''recursively descend the directory rooted at dir,
+def walktree(top, callback):
+    '''recursively descend the directory tree rooted at top,
        calling the callback function for each regular file'''
 
-    for f in os.listdir(dir):
-        pathname = '%s/%s' % (dir, f)
+    for f in os.listdir(top):
+        pathname = os.path.join(top, f)
         mode = os.stat(pathname)[ST_MODE]
         if S_ISDIR(mode):
             # It's a directory, recurse into it