@@ -953,7 +953,7 @@ call fails (for example because the path doesn't exist).
953953
954954 For each directory in the directory tree rooted at *self * (including
955955 *self * but excluding '.' and '..'), the method yields a 3-tuple of
956- ``(dirpath, dirnames, filenames) ``
956+ ``(dirpath, dirnames, filenames) ``.
957957
958958 *dirpath * is a :class: `Path ` to the directory currently being walked,
959959 *dirnames * is a list of strings for the names of subdirectories in *dirpath *
@@ -963,27 +963,27 @@ call fails (for example because the path doesn't exist).
963963 ``dirpath / name ``. Whether or not the lists are sorted is file
964964 system-dependent.
965965
966- If optional argument *top_down * is true or not specified , the triple for a
966+ If the optional argument *top_down * is true (which is the default) , the triple for a
967967 directory is generated before the triples for any of its subdirectories
968968 (directories are walked top-down). If *top_down * is false, the triple
969969 for a directory is generated after the triples for all of its subdirectories
970970 (directories are walked bottom-up). No matter the value of *top_down *, the
971- list of subdirectories is retrieved before the tuples for the directory and
971+ list of subdirectories is retrieved before the triples for the directory and
972972 its subdirectories are walked.
973973
974974 When *top_down * is true, the caller can modify the *dirnames * list in-place
975- (For example, using :keyword: `del ` or slice assignment), and :meth: `Path.walk `
976- will only recurse into the subdirectories whose names remain in *dirnames *;
977- this can be used to prune the search, or to impose a specific order of visiting,
975+ (for example, using :keyword: `del ` or slice assignment), and :meth: `Path.walk `
976+ will only recurse into the subdirectories whose names remain in *dirnames *.
977+ This can be used to prune the search, or to impose a specific order of visiting,
978978 or even to inform :meth: `Path.walk ` about directories the caller creates or
979979 renames before it resumes :meth: `Path.walk ` again. Modifying *dirnames * when
980- *top_down * is false has no effect on the behavior of :meth: `Path.walk() `, since the
980+ *top_down * is false has no effect on the behavior of :meth: `Path.walk() ` since the
981981 directories in *dirnames * have already been generated by the time *dirnames *
982982 is yielded to the caller.
983983
984984 By default, errors from :func: `os.scandir ` are ignored. If the optional
985985 argument *on_error * is specified, it should be a callable; it will be
986- called with one argument, an :exc: `OSError ` instance. It can handle the
986+ called with one argument, an :exc: `OSError ` instance. The callable can handle the
987987 error to continue the walk or re-raise it to stop the walk. Note that the
988988 filename is available as the ``filename `` attribute of the exception object.
989989
@@ -999,20 +999,19 @@ call fails (for example because the path doesn't exist).
999999 does not keep track of the directories it has already visited.
10001000
10011001 .. note ::
1002- :meth: `Path.walk ` assumes the directories it walks are not been modified during
1002+ :meth: `Path.walk ` assumes the directories it walks are not modified during
10031003 execution. For example, if a directory from *dirnames * has been replaced
10041004 with a symlink and *follow_symlinks * is false, :meth: `Path.walk ` will
10051005 still try to descend into it. To prevent such behavior, remove directories
10061006 from *dirnames * as appropriate.
10071007
10081008 .. note ::
10091009
1010- Unlike :func: `os.walk `, :meth: `Path.walk ` lists symlinks to directories into
1010+ Unlike :func: `os.walk `, :meth: `Path.walk ` lists symlinks to directories in
10111011 *filenames * if *follow_symlinks * is false.
10121012
10131013 This example displays the number of bytes used by all files in each directory,
1014- while ignoring ``__pycache__ `` directories.
1015- :file: `__pycache__ ` subdirectory::
1014+ while ignoring ``__pycache__ `` directories::
10161015
10171016 from pathlib import Path
10181017 for root, dirs, files in Path("cpython/Lib/concurrent").walk(on_error=print):
0 commit comments