diff options
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r-- | Lib/pathlib.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py index 825533d8d5f..d70fde0ea3b 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -799,7 +799,11 @@ class PurePath(object): @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: @@ -809,7 +813,11 @@ class PurePath(object): @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 [] |