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
8 changes: 8 additions & 0 deletions Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ we also call *flavours*:
>>> PurePath()
PurePosixPath('.')

An empty string in *pathsegments* also refers to the current directory.
This means that ``PurePath("")`` is equivalent to ``PurePath(".")``,
and consequently ``Path("").exists()`` will always return ``True``. This
differs from ``os.path.exists("")``, which returns ``False``.

>>> PurePath("")
PurePosixPath('.')
Comment on lines +139 to +145
Copy link
Member

Choose a reason for hiding this comment

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

I think the new text should be folded into the previous 4 lines. The result would then be:

When pathsegments is empty or a single empty string, the current directory is assumed::

  >>> PurePath(), PurePath('')
  (PurePosixPath('.'), PurePosixPath('.'))

The boolean value of either expression is True.
This differs from os.path.exists(""), which returns False.


If a segment is an absolute path, all previous segments are ignored
(like :func:`os.path.join`)::

Expand Down
Loading