Reconsider position of Attributes and Methods sections

Abierto
#608 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python

Línea de trabajo

Comienza con la lógica del orden de las secciones en numpydoc/docscrape.py en las líneas enlazadas. Revisa cómo el orden actual sirve a las clases frente a las funciones y resuelve el debate de diseño abierto antes de cambiarlo. Se considerará completado cuando haya un orden acordado que mantenga los parámetros de las clases agrupados adecuadamente sin alterar los diseños existentes de funciones y métodos.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

#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.

Lenguaje dominante
Python
Estrellas
354
Forks
185
Merge medio
4 min
PR fusionados (30 d)
1

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de numpy/numpydoc

Todos los issues de numpy/numpydoc

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.