Skip to content

Commit f014f15

Browse files
authored
docs: clarify Path.suffix (GH-106650)
1 parent 8d2f3c3 commit f014f15

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Doc/library/pathlib.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ Pure paths provide the following methods and properties:
432432

433433
.. attribute:: PurePath.suffix
434434

435-
The file extension of the final component, if any::
435+
The last dot-separated portion of the final component, if any::
436436

437437
>>> PurePosixPath('my/library/setup.py').suffix
438438
'.py'
@@ -441,10 +441,11 @@ Pure paths provide the following methods and properties:
441441
>>> PurePosixPath('my/library').suffix
442442
''
443443

444+
This is commonly called the file extension.
444445

445446
.. attribute:: PurePath.suffixes
446447

447-
A list of the path's file extensions::
448+
A list of the path's suffixes, often called file extensions::
448449

449450
>>> PurePosixPath('my/library.tar.gar').suffixes
450451
['.tar', '.gar']

Doc/library/zipfile.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,8 @@ Path objects are traversable using the ``/`` operator or ``joinpath``.
577577

578578
.. data:: Path.suffix
579579

580-
The file extension of the final component.
580+
The last dot-separated portion of the final component, if any.
581+
This is commonly called the file extension.
581582

582583
.. versionadded:: 3.11
583584
Added :data:`Path.suffix` property.
@@ -591,7 +592,7 @@ Path objects are traversable using the ``/`` operator or ``joinpath``.
591592

592593
.. data:: Path.suffixes
593594

594-
A list of the path’s file extensions.
595+
A list of the path’s suffixes, commonly called file extensions.
595596

596597
.. versionadded:: 3.11
597598
Added :data:`Path.suffixes` property.

0 commit comments

Comments
 (0)