python / python/cpython

Reorganize `os.path` documentation

Aperta
#130,536 8 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

docs easy
Lingua principale
Python
Stelle
77.2k
Fork
35.9k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dalla pagina della documentazione di os.path e rivedi le voci abspath, isabs, split e join elencate nell’issue. Controlla i PR collegati prima di iniziare, quindi determina se la direzione accettata consiste in una riorganizzazione oppure nell’aggiunta di link seealso ed esempi. Il lavoro è completo quando i riferimenti scelti sono facili da seguire e il comportamento di join con i percorsi assoluti è spiegato esplicitamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
documentation
Tipo di issue
Documentazione
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.