Skip to content

Commit

Permalink
docs: clarify Path.suffix (pythonGH-106650)
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat authored and kgdiem committed Jul 14, 2023
1 parent 58025d6 commit fd9f8d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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']
Expand Down
5 changes: 3 additions & 2 deletions Doc/library/zipfile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit fd9f8d6

Please sign in to comment.