New submission from Shaun Griffith <shaun.griffith.1...@gmail.com>:

As with many entries on the os.path doc page, splitext needs a typical example. 
Not grokking the bare minimum text, I had to actually try it in the interpreter 
to see what it did.

The one example that *is* there is an edge case, and does nothing to explain 
the normal behavior, or why this is the correct behavior for the edge case.

Here is where I tripped up:

Split the pathname path into a pair (root, ext) such that root + ext == path, 
and ext is empty or begins with a period and contains at most one period.

One interpretation of this is that ext is either empty, or has a period, _and 
nothing else_. 

Here are 2 examples for typical use:

>>> splitext('readme.txt')
('readme', '.txt')
>>> splitext('/some/long/pathname/warble.csv')
('/some/long/pathname/warble', '.csv')

----------
assignee: docs@python
components: Documentation
messages: 329414
nosy: docs@python, shaungriffith
priority: normal
severity: normal
status: open
title: os.path.splitext documentation needs typical example
type: enhancement
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35183>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to