mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Back out pathlib.Path.path attr. (Merge 3.5->3.6)
This commit is contained in:
commit
03e6061956
4 changed files with 0 additions and 62 deletions
|
@ -365,28 +365,6 @@ Pure paths provide the following methods and properties:
|
|||
''
|
||||
|
||||
|
||||
.. data:: PurePath.path
|
||||
|
||||
A string representing the full path::
|
||||
|
||||
>>> PurePosixPath('my/library/setup.py').path
|
||||
'my/library/setup.py'
|
||||
|
||||
This always returns the same value as ``str(p)``; it is included to
|
||||
serve as a one-off protocol. Code that wants to support both
|
||||
strings and ``pathlib.Path`` objects as filenames can write
|
||||
``arg = getattr(arg, 'path', arg)`` to get the path as a string.
|
||||
This can then be passed to various system calls or library
|
||||
functions that expect a string. Unlike the alternative
|
||||
``arg = str(arg)``, this will still raise an exception if an object
|
||||
of some other type is given by accident.
|
||||
|
||||
A nice advantage is that this protocol is also supported by
|
||||
:class:`os.DirEntry` objects returned by :func:`os.scandir`.
|
||||
|
||||
.. versionadded:: 3.4.5
|
||||
.. versionadded:: 3.5.2
|
||||
|
||||
.. data:: PurePath.suffix
|
||||
|
||||
The file extension of the final component, if any::
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue