Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
GH-99334: Explain that PurePath.is_relative_to() is purely lexical.
  • Loading branch information
barneygale committed Jan 13, 2024
commit a798373a1c3994ab43d3a1eaf94db1811efe9197
7 changes: 7 additions & 0 deletions Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,13 @@ Pure paths provide the following methods and properties:
>>> p.is_relative_to('/usr')
False

This method is string-based; it neither accesses the filesystem nor treats
"``..``" segments specially. The following code is equivalent:

>>> u = PurePath('/usr')
>>> u == p or u in p.parents
True

.. versionadded:: 3.9

.. deprecated-removed:: 3.12 3.14
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Explain that :meth:`PurePath.is_relative_to` is a purely lexical operation.