Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,11 @@ def name(self):

@property
def suffix(self):
"""The final component's last suffix, if any."""
"""
The final component's last suffix, if any.

This includes the leading period. For example: '.txt'
"""
name = self.name
i = name.rfind('.')
if 0 < i < len(name) - 1:
Expand All @@ -805,7 +809,11 @@ def suffix(self):

@property
def suffixes(self):
"""A list of the final component's suffixes, if any."""
"""
A list of the final component's suffixes, if any.

These include the leading periods. For example: ['.tar', '.gz']
"""
name = self.name
if name.endswith('.'):
return []
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Clarify docstrings of pathlib suffix(es)