summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2024-01-23 01:06:44 (GMT)
committerGitHub <noreply@github.com>2024-01-23 01:06:44 (GMT)
commit3a61d24062aaa1e13ba794360b6c765d9a1f2b06 (patch)
tree3d212b0b2400636b9c75680b89f2fdc16e4078fe
parent9af9ac153acb4198878ad81ef438aca2b808e45d (diff)
downloadcpython-3a61d24062aaa1e13ba794360b6c765d9a1f2b06.zip
cpython-3a61d24062aaa1e13ba794360b6c765d9a1f2b06.tar.gz
cpython-3a61d24062aaa1e13ba794360b6c765d9a1f2b06.tar.bz2
GH-99334: Explain that `PurePath.is_relative_to()` is purely lexical. (#114031)
-rw-r--r--Doc/library/pathlib.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst
index b924f47..faff3bc 100644
--- a/Doc/library/pathlib.rst
+++ b/Doc/library/pathlib.rst
@@ -515,6 +515,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
+ False
+
.. versionadded:: 3.9
.. deprecated-removed:: 3.12 3.14