@@ -312,11 +312,12 @@ def walk(top, topdown=True, onerror=None, followlinks=False):
312312
313313 When topdown is true, the caller can modify the dirnames list in-place
314314 (e.g., via del or slice assignment), and walk will only recurse into the
315- subdirectories whose names remain in dirnames; this can be used to prune
316- the search, or to impose a specific order of visiting. Modifying
317- dirnames when topdown is false is ineffective, since the directories in
318- dirnames have already been generated by the time dirnames itself is
319- generated.
315+ subdirectories whose names remain in dirnames; this can be used to prune the
316+ search, or to impose a specific order of visiting. Modifying dirnames when
317+ topdown is false is ineffective, since the directories in dirnames have
318+ already been generated by the time dirnames itself is generated. No matter
319+ the value of topdown, the list of subdirectories is retrieved before the
320+ tuples for the directory and its subdirectories are generated.
320321
321322 By default errors from the os.listdir() call are ignored. If
322323 optional arg 'onerror' is specified, it should be a function; it
@@ -344,6 +345,7 @@ def walk(top, topdown=True, onerror=None, followlinks=False):
344345 print("bytes in", len(files), "non-directory files")
345346 if 'CVS' in dirs:
346347 dirs.remove('CVS') # don't visit CVS directories
348+
347349 """
348350
349351 islink , join , isdir = path .islink , path .join , path .isdir
0 commit comments