diff options
author | Chris Adams <chris@improbable.org> | 2022-07-15 22:09:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-15 22:09:27 (GMT) |
commit | 3789c635772fbdeb5d0fc32aa811fd6b1d935a60 (patch) | |
tree | 23b211c4caba12672e9d83670b488acdcfd54938 /Doc | |
parent | 582ae86b3f07d806f145b3eb9009efd9fbf2e041 (diff) | |
download | cpython-3789c635772fbdeb5d0fc32aa811fd6b1d935a60.zip cpython-3789c635772fbdeb5d0fc32aa811fd6b1d935a60.tar.gz cpython-3789c635772fbdeb5d0fc32aa811fd6b1d935a60.tar.bz2 |
Add additional pointers to pathlib's mapping to os.path functions (#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: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/pathlib.rst | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 2b79869..d5cda3a 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -1300,7 +1300,8 @@ Below is a table mapping various :mod:`os` functions to their corresponding :func:`os.path.basename` :data:`PurePath.name` :func:`os.path.dirname` :data:`PurePath.parent` :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 |