Skip to content

Commit 71abd1d

Browse files
committed
bpo-38422: Clarify docstrings of pathlib suffix(es)
1 parent 01171eb commit 71abd1d

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Lib/pathlib.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,11 @@ def name(self):
795795

796796
@property
797797
def suffix(self):
798-
"""The final component's last suffix, if any."""
798+
"""
799+
The final component's last suffix, if any.
800+
801+
This includes the leading period. For example: '.txt'
802+
"""
799803
name = self.name
800804
i = name.rfind('.')
801805
if 0 < i < len(name) - 1:
@@ -805,7 +809,11 @@ def suffix(self):
805809

806810
@property
807811
def suffixes(self):
808-
"""A list of the final component's suffixes, if any."""
812+
"""
813+
A list of the final component's suffixes, if any.
814+
815+
These include the leading periods. For example: ['.tar', '.gz']
816+
"""
809817
name = self.name
810818
if name.endswith('.'):
811819
return []
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Clarify docstrings of pathlib suffix(es)

0 commit comments

Comments
 (0)