[issue34931] os.path.splitext with more dots

Serhiy Storchaka report at bugs.python.org
Mon Jan 3 03:44:42 EST 2022


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

There are other issues with the documentation of splitext().

1. It uses term "extension" (it is even a part of function name), but it is vague and usually does not include a period. On Windows the extension of "python.exe" is "exe", not ".exe". On Unix term "suffix" is commonly used, ".exe" is a suffix. It is also used in pathlib. I suggest to replace "extension" with "suffix".

2. It is not specified that only the part of the last path component is included in the suffix, and leading periods of the last path component are ignored, not just leading periods of the path. So splitext('mail.dir/') == ('mail.dir/', '') and splitext('/home/user/.etc') is ('/home/user/.etc', ''). It is not documented that splitext() works with multi-component paths at all.

----------
nosy: +pitrou

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34931>
_______________________________________


More information about the Python-bugs-list mailing list