summaryrefslogtreecommitdiff
path: root/Lib/pathlib.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2016-01-06 11:01:42 -0800
committerGuido van Rossum <guido@python.org>2016-01-06 11:01:42 -0800
commite42823153990ab5a4bb5f9148458cf48e189f4f9 (patch)
treed9f073721f49104b44e505f308441f1e005a38c0 /Lib/pathlib.py
parent69bfb15bd8cb87dd07f1cf6c53f78b399c7ef937 (diff)
downloadcpython-git-e42823153990ab5a4bb5f9148458cf48e189f4f9.tar.gz
Issue #22570: Add 'path' attribute to pathlib.Path objects.
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r--Lib/pathlib.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index cab4151e22..1bd457a487 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -645,6 +645,13 @@ class PurePath(object):
self._parts) or '.'
return self._str
+ @property
+ def path(self):
+ try:
+ return self._str
+ except AttributeError:
+ return str(self)
+
def as_posix(self):
"""Return the string representation of the path with forward (/)
slashes."""