diff options
author | Guido van Rossum <guido@python.org> | 2016-01-06 11:01:42 -0800 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2016-01-06 11:01:42 -0800 |
commit | e42823153990ab5a4bb5f9148458cf48e189f4f9 (patch) | |
tree | d9f073721f49104b44e505f308441f1e005a38c0 /Lib/pathlib.py | |
parent | 69bfb15bd8cb87dd07f1cf6c53f78b399c7ef937 (diff) | |
download | cpython-git-e42823153990ab5a4bb5f9148458cf48e189f4f9.tar.gz |
Issue #22570: Add 'path' attribute to pathlib.Path objects.
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r-- | Lib/pathlib.py | 7 |
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.""" |