diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 45b5797058f623..04b1bd01af1187 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -131,10 +131,11 @@ we also call *flavours*: >>> PurePath(Path('foo'), Path('bar')) PurePosixPath('foo/bar') - When *pathsegments* is empty, the current directory is assumed:: + When *pathsegments* is empty or consists only of empty strings, + the current directory is assumed:: - >>> PurePath() - PurePosixPath('.') + >>> PurePath(), PurePath('') + (PurePosixPath('.'), PurePosixPath('.')) If a segment is an absolute path, all previous segments are ignored (like :func:`os.path.join`):: @@ -1040,8 +1041,8 @@ Querying file type and status .. method:: Path.exists(*, follow_symlinks=True) - Return ``True`` if the path points to an existing file or directory. - ``False`` will be returned if the path is invalid, inaccessible or missing. + Return ``True`` if the path points to an existing file or directory and + ``False`` if the path is invalid, inaccessible or missing. Use :meth:`Path.stat` to distinguish between these cases. This method normally follows symlinks; to check if a symlink exists, add @@ -1049,6 +1050,8 @@ Querying file type and status :: + >>> Path('').exists() # The current directory. + True >>> Path('.').exists() True >>> Path('setup.py').exists()