This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add concrete examples to os.path documentation
Type: enhancement Stage:
Components: Documentation Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: andrei.avk, docs@python, jack__d, rhettinger, theacodes
Priority: normal Keywords:

Created on 2020-10-05 16:06 by theacodes, last changed 2022-04-11 14:59 by admin.

Messages (5)
msg378043 - (view) Author: Stargirl Flowers (theacodes) Date: 2020-10-05 16:06
Presently the documentation for os.path (https://docs.python.org/3.8/library/os.path.html) doesn't contain any concrete examples of the input and outputs of the various path manipulation functions.

Contrast this to the Node.js documentation for similar functionality (https://nodejs.org/api/path.html)

We could add replesque examples such as:

>> os.path.abspath("example.py")
"/full/path/to/example.py"

...

>> os.path.basename("example.py")
"example"

& so on.

I believe it would be useful for us to have concrete examples here and I'm happy to contribute this. If anyone feels differently, let me know.
msg398912 - (view) Author: Andrei Kulakov (andrei.avk) * (Python triager) Date: 2021-08-04 16:42
Some examples were added since this issue was created, but more can be added. Stargirl: feel free to open a PR, I can review it.
msg399025 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2021-08-05 18:26
Concrete examples for os.path are problematic because typical inputs and outputs vary across difference file systems.  The point of os.path is to hide these differences.
msg399027 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2021-08-05 18:37
If some examples are added, the should note which operating system is being used.
msg399032 - (view) Author: Jack DeVries (jack__d) * Date: 2021-08-05 19:37
> Some examples were added since this issue was created

See bpo-35183
History
Date User Action Args
2022-04-11 14:59:36adminsetgithub: 86112
2021-08-05 19:37:30jack__dsetnosy: + jack__d
messages: + msg399032
2021-08-05 18:37:20rhettingersetmessages: + msg399027
2021-08-05 18:26:50rhettingersetnosy: + rhettinger
messages: + msg399025
2021-08-04 16:42:30andrei.avksetnosy: + andrei.avk
messages: + msg398912
2020-10-05 16:06:07theacodescreate