Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,13 @@ 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('.'))

The boolean value of either expression is True.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a little odd, in the current state I don't think it's helpful. Since PurePath doesn't define a __bool__ or __len__, it's always true.


If a segment is an absolute path, all previous segments are ignored
(like :func:`os.path.join`)::
Expand Down Expand Up @@ -1041,6 +1044,7 @@ Querying file type and status
.. method:: Path.exists(*, follow_symlinks=True)

Return ``True`` if the path points to an existing file or directory.
This includes empty paths, which Path interprets as the current directory.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this seems a bit "wedged in" what about adding it to the examples, with a comment, instead?

>>> Path('').exists()  # the current directory
True

``False`` will be returned if the path is invalid, inaccessible or missing.
Use :meth:`Path.stat` to distinguish between these cases.

Expand Down
Loading