summaryrefslogtreecommitdiff
path: root/Doc/library/os.rst
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2016-06-24 12:21:47 -0700
committerBrett Cannon <brett@python.org>2016-06-24 12:21:47 -0700
commit7fd350e789b7fc82243df2efda7d1f42f30ad7fb (patch)
treef39c9ee22a6adbe08ca4bace7ef57f6ce3356030 /Doc/library/os.rst
parenta52c718a5d46902bbe429710e02f45f738565889 (diff)
downloadcpython-7fd350e789b7fc82243df2efda7d1f42f30ad7fb.tar.gz
Issue #27186: Define what a "path-like object" is.
Thanks to Dusty Phillips for the initial patch.
Diffstat (limited to 'Doc/library/os.rst')
-rw-r--r--Doc/library/os.rst16
1 files changed, 9 insertions, 7 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 0346cc22a0..e7cf4fa835 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -171,8 +171,9 @@ process and user.
.. function:: fsencode(filename)
- Encode *filename* to the filesystem encoding with ``'surrogateescape'``
- error handler, or ``'strict'`` on Windows; return :class:`bytes` unchanged.
+ Encode :term:`path-like <path-like object>` *filename* to the filesystem
+ encoding with ``'surrogateescape'`` error handler, or ``'strict'`` on
+ Windows; return :class:`bytes` unchanged.
:func:`fsdecode` is the reverse function.
@@ -185,8 +186,9 @@ process and user.
.. function:: fsdecode(filename)
- Decode *filename* from the filesystem encoding with ``'surrogateescape'``
- error handler, or ``'strict'`` on Windows; return :class:`str` unchanged.
+ Decode the :term:`path-like <path-like object>` *filename* from the
+ filesystem encoding with ``'surrogateescape'`` error handler, or ``'strict'``
+ on Windows; return :class:`str` unchanged.
:func:`fsencode` is the reverse function.
@@ -2003,8 +2005,8 @@ features:
control over errors, you can catch :exc:`OSError` when calling one of the
``DirEntry`` methods and handle as appropriate.
- To be directly usable as a path-like object, ``DirEntry`` implements the
- :class:`os.PathLike` interface.
+ To be directly usable as a :term:`path-like object`, ``DirEntry`` implements
+ the :class:`os.PathLike` interface.
Attributes and methods on a ``DirEntry`` instance are as follows:
@@ -2112,7 +2114,7 @@ features:
Note that there is a nice correspondence between several attributes
and methods of ``DirEntry`` and of :class:`pathlib.Path`. In
- particular, the ``name`` and ``path`` attributes have the same
+ particular, the ``name`` attribute has the same
meaning, as do the ``is_dir()``, ``is_file()``, ``is_symlink()``
and ``stat()`` methods.