summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2023-07-13 19:24:54 (GMT)
committerGitHub <noreply@github.com>2023-07-13 19:24:54 (GMT)
commitf014f1567c081542aaf5cecce118edf35e09bcc5 (patch)
tree0e6f2a3c6a3bda97d1d38613f138106e290a0455
parent8d2f3c36caf9ecdee1176314b18388aef6e7f2c2 (diff)
downloadcpython-f014f1567c081542aaf5cecce118edf35e09bcc5.zip
cpython-f014f1567c081542aaf5cecce118edf35e09bcc5.tar.gz
cpython-f014f1567c081542aaf5cecce118edf35e09bcc5.tar.bz2
docs: clarify Path.suffix (GH-106650)
-rw-r--r--Doc/library/pathlib.rst5
-rw-r--r--Doc/library/zipfile.rst5
2 files changed, 6 insertions, 4 deletions
diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst
index 3385754..af81df2 100644
--- a/Doc/library/pathlib.rst
+++ b/Doc/library/pathlib.rst
@@ -432,7 +432,7 @@ Pure paths provide the following methods and properties:
.. attribute:: PurePath.suffix
- The file extension of the final component, if any::
+ The last dot-separated portion of the final component, if any::
>>> PurePosixPath('my/library/setup.py').suffix
'.py'
@@ -441,10 +441,11 @@ Pure paths provide the following methods and properties:
>>> PurePosixPath('my/library').suffix
''
+ This is commonly called the file extension.
.. attribute:: PurePath.suffixes
- A list of the path's file extensions::
+ A list of the path's suffixes, often called file extensions::
>>> PurePosixPath('my/library.tar.gar').suffixes
['.tar', '.gar']
diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst
index 45f3d34..bd951e4 100644
--- a/Doc/library/zipfile.rst
+++ b/Doc/library/zipfile.rst
@@ -577,7 +577,8 @@ Path objects are traversable using the ``/`` operator or ``joinpath``.
.. data:: Path.suffix
- The file extension of the final component.
+ The last dot-separated portion of the final component, if any.
+ This is commonly called the file extension.
.. versionadded:: 3.11
Added :data:`Path.suffix` property.
@@ -591,7 +592,7 @@ Path objects are traversable using the ``/`` operator or ``joinpath``.
.. data:: Path.suffixes
- A list of the path’s file extensions.
+ A list of the path’s suffixes, commonly called file extensions.
.. versionadded:: 3.11
Added :data:`Path.suffixes` property.