bpo-24899: Add comparison table for os.path -> pathlib (GH-1753)

This commit is contained in:
Jamiel Almeida 2017-06-02 11:36:02 -07:00 committed by Brett Cannon
parent 7a99625e0d
commit ae8750bca8
2 changed files with 38 additions and 4 deletions

View File

@ -1055,3 +1055,36 @@ call fails (for example because the path doesn't exist):
'Text file contents'
.. versionadded:: 3.5
Correspondence to tools in the :mod:`os` module
-----------------------------------------------
Below is a table mapping various :mod:`os` functions to their corresponding
:class:`PurePath`/:class:`Path` equivalent.
.. note::
Although :func:`os.path.relpath` and :meth:`PurePath.relative_to` have some
overlapping use-cases, their semantics differ enough to warrant not
considering them equivalent.
============================ ==============================
os and os.path pathlib
============================ ==============================
:func:`os.path.abspath` :meth:`Path.resolve`
:func:`os.getcwd` :func:`Path.cwd`
:func:`os.path.exists` :meth:`Path.exists`
:func:`os.path.expanduser` :meth:`Path.expanduser` and
:meth:`Path.home`
:func:`os.path.isdir` :meth:`Path.is_dir`
:func:`os.path.isfile` :meth:`Path.is_file`
:func:`os.path.islink` :meth:`Path.is_symlink`
:func:`os.stat` :meth:`Path.stat`,
:meth:`Path.owner`,
:meth:`Path.group`
:func:`os.path.isabs` :meth:`PurePath.is_absolute`
:func:`os.path.join` :func:`PurePath.joinpath`
:func:`os.path.basename` :data:`PurePath.name`
:func:`os.path.dirname` :data:`PurePath.parent`
:func:`os.path.splitext` :data:`PurePath.suffix`
============================ ==============================

View File

@ -33,6 +33,7 @@ Fred Allen
Jeff Allen
Ray Allen
Billy G. Allie
Jamiel Almeida
Kevin Altis
Skyler Leigh Amador
Joe Amenta
@ -436,6 +437,7 @@ Tim Everett
Paul Everitt
David Everly
Daniel Evers
evilzero
Winston Ewert
Greg Ewing
Martijn Faassen
@ -523,6 +525,7 @@ Elazar (אלעזר) Gershuni
Ben Gertzfield
Nadim Ghaznavi
Dinu Gherman
Subhendu Ghosh
Jonathan Giddy
Johannes Gijsbers
Michael Gilfix
@ -1242,6 +1245,7 @@ Jérôme Radix
Burton Radons
Abhilash Raj
Shorya Raj
Dhushyanth Ramasamy
Jeff Ramnani
Bayard Randel
Varpu Rantala
@ -1505,6 +1509,7 @@ Nathan Sullivan
Mark Summerfield
Reuben Sumner
Eryk Sun
Sanjay Sundaresan
Marek Šuppa
Hisao Suzuki
Kalle Svensson
@ -1747,7 +1752,3 @@ Jelle Zijlstra
Gennadiy Zlobin
Doug Zongker
Peter Åstrand
evilzero
Dhushyanth Ramasamy
Subhendu Ghosh
Sanjay Sundaresan