Skip to content

Commit 734c8b7

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: Ezio Melotti <[email protected]> Co-authored-by: Ezio Melotti <[email protected]> (cherry picked from commit 3789c63) Co-authored-by: Chris Adams <[email protected]>
1 parent 8dc4de3 commit 734c8b7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Doc/library/pathlib.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,8 @@ Below is a table mapping various :mod:`os` functions to their corresponding
13191319
:func:`os.path.basename` :data:`PurePath.name`
13201320
:func:`os.path.dirname` :data:`PurePath.parent`
13211321
:func:`os.path.samefile` :meth:`Path.samefile`
1322-
:func:`os.path.splitext` :data:`PurePath.suffix`
1322+
:func:`os.path.splitext` :data:`PurePath.stem` and
1323+
:data:`PurePath.suffix`
13231324
==================================== ==============================
13241325

13251326
.. rubric:: Footnotes

0 commit comments

Comments
 (0)