Reconsider position of Attributes and Methods sections

オープン
#608 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
documentation

調査の方向性

リンク先の行にある numpydoc/docscrape.py のセクション順序ロジックから始めてください。現在の順序が関数に対してクラスをどのように扱っているかを確認し、変更する前に未解決の設計に関する議論を解決してください。クラスのパラメーターを適切にグループ化しつつ、既存の関数およびメソッドのレイアウトを崩さない、合意された順序が決まれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Python
スター
354
フォーク
185
平均マージ
4分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

numpy/numpydoc のほかの issue

numpy/numpydoc の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。