mirror of
https://github.com/python/cpython.git
synced 2025-11-09 14:06:30 +00:00
Cross-reference os.DirEntry and pathlib.Path for issue #22570.
This commit is contained in:
parent
05075203c5
commit
1469d744bc
2 changed files with 10 additions and 0 deletions
|
|
@ -2035,6 +2035,12 @@ features:
|
||||||
The result is cached on the ``DirEntry`` object. Call :func:`os.stat`
|
The result is cached on the ``DirEntry`` object. Call :func:`os.stat`
|
||||||
to fetch up-to-date information.
|
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
|
.. versionadded:: 3.5
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -381,7 +381,11 @@ Pure paths provide the following methods and properties:
|
||||||
``arg = str(arg)``, this will still raise an exception if an object
|
``arg = str(arg)``, this will still raise an exception if an object
|
||||||
of some other type is given by accident.
|
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.4.5
|
||||||
|
.. versionadded:: 3.5.2
|
||||||
|
|
||||||
.. data:: PurePath.suffix
|
.. data:: PurePath.suffix
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue