Reconsider position of Attributes and Methods sections

Aperta
#608 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
documentation

Direzione di ricerca

Inizia dalla logica dell’ordine delle sezioni in numpydoc/docscrape.py alle righe collegate. Esamina in che modo l’ordine attuale gestisce le classi rispetto alle funzioni e risolvi la discussione di progettazione aperta prima di modificarlo. Il lavoro è completato quando viene concordato un ordine che mantenga raggruppati in modo appropriato i parametri delle classi senza alterare i layout esistenti di funzioni e metodi.

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

Descrizione

#571 changed the section order to move Attributes and Methods right behind Parameters.

The order is now https://github.com/numpy/numpydoc/blob/532cd7d71ceee4e00fd13fa5faf038f2b4d95905/numpydoc/docscrape.py#L118-L137

For classes, we can get the order Paramters > Attributes > Methods > Other Parameters , which IMHO is not quite usable as the Other Parameters are very far away from Parameters.

We have to consider that the ordering should work both for classes and methods. As far as I understand, the motivation for Other Parameters is to deemphasise them and for methods to have the (typically short) sections Returns/Yields/Receives closer to the top.

I propose to move Attributes and Methods below Other Parameters, i.e.

Parameters
Returns
Yields
Receives
Other Parameters
Attributes
Methods
  • There's no change for functions / methods as the don't use Attributes and Methods
  • There's no change for classes without "Other Parameters" because they don't use Returns/Yields/Receives
  • For classes with "Other Parameters" the sequence is "Parameters > Other Parameters > Attributes > Methods", which I think is better because the first two are input values to the construtor, while the other two are properties of the class.

One could argue that one should alternatively not use "Other Parameters" if one wants to render them next to each other anyway. But I claim it's still helpful to de-emphasize additional parameters through that extra section.

Lingua principale
Python
Stelle
354
Fork
185
Merge medio
4m
PR unite (30g)
1

Preparare l'ambiente

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.

Altre issue di numpy/numpydoc

Tutte le issue di numpy/numpydoc

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.