diff options
author | Guido van Rossum <guido@dropbox.com> | 2016-01-06 11:03:47 -0800 |
---|---|---|
committer | Guido van Rossum <guido@dropbox.com> | 2016-01-06 11:03:47 -0800 |
commit | 483397a235630385c893941fee76379041612ee5 (patch) | |
tree | ac0856036c33dbc31ae00ce41f92aad431269ecd /Lib/pathlib.py | |
parent | e630b6818f28b6c4f8845fbaf2d115bbc3f2b733 (diff) | |
parent | 1a4afec0d66d8843834250836d1056ed6d687385 (diff) | |
download | cpython-git-483397a235630385c893941fee76379041612ee5.tar.gz |
Issue #22570: Add 'path' attribute to pathlib.Path objects. (Merge 3.5->3.6)
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 d03aededa4..a1e0a822d2 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -690,6 +690,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.""" |