python / python/cpython

Reorganize `os.path` documentation

Đang mở
#130,536 8 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

docs easy
Ngôn ngữ chính
Python
Star
77.2k
Fork
35.9k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

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.join without a link.
  • os.path.isabs could backlink to os.path.abspath.
  • os.path.split mentions os.path.join but 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với trang tài liệu về os.path và xem lại các mục abspath, isabs, split và join được liệt kê trong issue. Kiểm tra các PR được liên kết trước khi bắt đầu, sau đó xác định xem hướng đi được chấp nhận là tổ chức lại hay bổ sung các liên kết seealso và ví dụ. Được xem là hoàn tất khi các tham chiếu đã chọn dễ theo dõi và hành vi của join với các đường dẫn tuyệt đối được giải thích rõ ràng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
documentation
Loại issue
Tài liệu
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.