changeset: 99788:eab349b5c6d7 branch: 3.5 user: Guido van Rossum date: Wed Jan 06 11:36:03 2016 -0800 files: Doc/library/os.rst Doc/library/pathlib.rst description: Cross-reference os.DirEntry and pathlib.Path for issue #22570. diff -r 1a6b485e717f -r eab349b5c6d7 Doc/library/os.rst --- a/Doc/library/os.rst Wed Jan 06 11:26:36 2016 -0800 +++ b/Doc/library/os.rst Wed Jan 06 11:36:03 2016 -0800 @@ -2035,6 +2035,12 @@ The result is cached on the ``DirEntry`` object. Call :func:`os.stat` to fetch up-to-date information. + 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 + meaning, as do the ``is_dir()``, ``is_file()``, ``is_symlink()`` + and ``stat()`` methods. + .. versionadded:: 3.5 diff -r 1a6b485e717f -r eab349b5c6d7 Doc/library/pathlib.rst --- a/Doc/library/pathlib.rst Wed Jan 06 11:26:36 2016 -0800 +++ b/Doc/library/pathlib.rst Wed Jan 06 11:36:03 2016 -0800 @@ -381,7 +381,11 @@ ``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