[Python-checkins] peps: relative() becomes relative_to()
antoine.pitrou
python-checkins at python.org
Mon Nov 4 16:19:27 CET 2013
http://hg.python.org/peps/rev/857f13a5c8c1
changeset: 5250:857f13a5c8c1
user: Antoine Pitrou <solipsis at pitrou.net>
date: Mon Nov 04 16:19:23 2013 +0100
summary:
relative() becomes relative_to()
files:
pep-0428.txt | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/pep-0428.txt b/pep-0428.txt
--- a/pep-0428.txt
+++ b/pep-0428.txt
@@ -445,18 +445,18 @@
Making the path relative
^^^^^^^^^^^^^^^^^^^^^^^^
-The ``relative()`` method computes the relative difference of a path to
+The ``relative_to()`` method computes the relative difference of a path to
another::
- >>> PurePosixPath('/usr/bin/python').relative('/usr')
+ >>> PurePosixPath('/usr/bin/python').relative_to('/usr')
PurePosixPath('bin/python')
ValueError is raised if the method cannot return a meaningful value::
- >>> PurePosixPath('/usr/bin/python').relative('/etc')
+ >>> PurePosixPath('/usr/bin/python').relative_to('/etc')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
- File "pathlib.py", line 926, in relative
+ File "pathlib.py", line 926, in relative_to
.format(str(self), str(formatted)))
ValueError: '/usr/bin/python' does not start with '/etc'
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list