Reorganize `os.path` documentation
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
The os.path documentation is alphabetically sorted. That's great because it's easy to find a function. However, this also means that functions shouldn't reference other functions documented later as the reader may not have been aware of them before.
An alternative is to reorganize the documentation page so that we put at the top the most used functions such as os.path.join. The latter caused a bit of confusion in gh-130527, where neither the OP nor me remembered that os.path.join("/a", "/b") == "/b".
If reorganizing the documentation is not preferred, we should at least add .. seealso:: directives and clickable links so that any function mentioned but not yet documented at the time of reading can be easily looked up.
- os.path.abspath contains a reference to
os.path.joinwithout a link. - os.path.isabs could backlink to
os.path.abspath. - os.path.split mentions
os.path.joinbut as it's far away, we could backlink it. - os.path.join mentions "If a segment is an absolute path (which on Windows requires both a drive and a root), then all previous segments are ignored and joining continues from the absolute path segment.". We should add an example as it would be more explicit and teaching (e.g.,
os.path.join("/home/foo", "/home/bar") == "/home/bar".
Linked PRs
- gh-130557
- gh-131872
- gh-132408
- gh-142800
- gh-142801
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 os.path 文件頁面開始,檢視 issue 中列出的 abspath、isabs、split 和 join 項目。開始之前先查看已連結的 PR,然後確定已接受的方向是重新組織,還是新增 seealso 連結和範例。完成的標準是所選參考內容易於理解,並且明確說明絕對路徑的 join 行為。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- documentation
- Issue 類型
- 文件
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100