summaryrefslogtreecommitdiffstats
path: root/Lib/pathlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r--Lib/pathlib.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index 6355ae8..80923c7 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -886,6 +886,15 @@ class PurePath(object):
return self._from_parsed_parts('', root if n == 1 else '',
abs_parts[n:])
+ def is_relative_to(self, *other):
+ """Return True if the path is relative to another path or False.
+ """
+ try:
+ self.relative_to(*other)
+ return True
+ except ValueError:
+ return False
+
@property
def parts(self):
"""An object providing sequence-like access to the