Skip to content
Snippets Groups Projects
Unverified Commit 734c8b7e authored by Miss Islington (bot)'s avatar Miss Islington (bot) Committed by GitHub
Browse files

Add additional pointers to pathlib's mapping to os.path functions (GH-94828)



* Add additional pointers to pathlib's mapping to os.path functions

os.path.splitext has a somewhat quirky signature since it mixes the path and filename components but I wanted the documentation to mention `PurePath.stem` as the natural counterpart to `PurePath.suffix` for the common use of `os.path.splitext` to turn "file.py" into "file" and "py".

Technically this could have some discussion of how to handle the parent directory hierarchy but that seems a bit out of keeping with the spirit of this table so I omitted mentioning `PurePath.parents` here.

* Update Doc/library/pathlib.rst

Co-authored-by: default avatarEzio Melotti <ezio.melotti@gmail.com>

Co-authored-by: default avatarEzio Melotti <ezio.melotti@gmail.com>
(cherry picked from commit 3789c635)

Co-authored-by: default avatarChris Adams <chris@improbable.org>
parent 8dc4de3a
Branches
Tags
No related merge requests found
...@@ -1319,7 +1319,8 @@ Below is a table mapping various :mod:`os` functions to their corresponding ...@@ -1319,7 +1319,8 @@ Below is a table mapping various :mod:`os` functions to their corresponding
:func:`os.path.basename` :data:`PurePath.name` :func:`os.path.basename` :data:`PurePath.name`
:func:`os.path.dirname` :data:`PurePath.parent` :func:`os.path.dirname` :data:`PurePath.parent`
:func:`os.path.samefile` :meth:`Path.samefile` :func:`os.path.samefile` :meth:`Path.samefile`
:func:`os.path.splitext` :data:`PurePath.suffix` :func:`os.path.splitext` :data:`PurePath.stem` and
:data:`PurePath.suffix`
==================================== ============================== ==================================== ==============================
.. rubric:: Footnotes .. rubric:: Footnotes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment