diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2020-09-04 18:19:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-04 18:19:30 (GMT) |
commit | 306cfb3a37e1438f6ba9f0a9f3af3c00aae4ec64 (patch) | |
tree | acbc10a13a6aa79beffaabced6b1f0155976e631 /Doc/library/os.rst | |
parent | 81715808716198471fbca0a3db42ac408468dbc5 (diff) | |
download | cpython-306cfb3a37e1438f6ba9f0a9f3af3c00aae4ec64.zip cpython-306cfb3a37e1438f6ba9f0a9f3af3c00aae4ec64.tar.gz cpython-306cfb3a37e1438f6ba9f0a9f3af3c00aae4ec64.tar.bz2 |
bpo-40486: Specify what happens if directory content change diring iteration (GH-22025)
Diffstat (limited to 'Doc/library/os.rst')
-rw-r--r-- | Doc/library/os.rst | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 275b2d3..8c3bc5f 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1852,6 +1852,8 @@ features: Return a list containing the names of the entries in the directory given by *path*. The list is in arbitrary order, and does not include the special entries ``'.'`` and ``'..'`` even if they are present in the directory. + If a file is removed from or added to the directory during the call of + this function, whether a name for that file be included is unspecified. *path* may be a :term:`path-like object`. If *path* is of type ``bytes`` (directly or indirectly through the :class:`PathLike` interface), @@ -2257,7 +2259,9 @@ features: Return an iterator of :class:`os.DirEntry` objects corresponding to the entries in the directory given by *path*. The entries are yielded in arbitrary order, and the special entries ``'.'`` and ``'..'`` are not - included. + included. If a file is removed from or added to the directory after + creating the iterator, whether an entry for that file be included is + unspecified. Using :func:`scandir` instead of :func:`listdir` can significantly increase the performance of code that also needs file type or file @@ -3007,7 +3011,10 @@ features: *filenames* is a list of the names of the non-directory files in *dirpath*. Note that the names in the lists contain no path components. To get a full path (which begins with *top*) to a file or directory in *dirpath*, do - ``os.path.join(dirpath, name)``. + ``os.path.join(dirpath, name)``. Whether or not the lists are sorted + depends on the file system. If a file is removed from or added to the + *dirpath* directory during generating the lists, whether a name for that + file be included is unspecified. If optional argument *topdown* is ``True`` or not specified, the triple for a directory is generated before the triples for any of its subdirectories |