Lacking description of how to correctly implement indexing syntax support.
オープン
まだ誰も着手していません。
docs
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Documentation
During a discussion on idea of minimizing requirements for children of collections.abc.Sequence, it was pointed out, that documentation is currently lacking sufficient description on expected behaviour of method __getitem__.
The part in question starts with first note after __length_hint__ description. I started by writing, to see what's missing. Non-trivial changes include:.
- Translation of
a[1:2, 3:5]intoa[(slice(1, 2, None), slice(3, 5, None))]. - Because that translation exist, custom behaviour types (like matrix) are also supported.
- Slicing should return object of the same type, or at least similar.
- If description is good, then note about for loops is unnecessary. (Plus it's outdated, for loops call
iterandnext, the iterator calls__getitem__). - One object can implement both protocols correctly (at the same time).
- Setting
__iter__toNonemakesiternot fallback to sequence protocol. (And similar point forreversed). - Having ABC as parent, or explicitly assigning methods from them, isn't worst than not defining them at all.
- (After coping fallback description from
__reversed__, correct that)iterdon't need full sequence protocol, just__getitem__method.
Linked PRs
- gh-120942
- gh-122178
- gh-141124
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
issueにリンクされたリファレンスに従い、__length_hint__の説明の後にあるPythonデータモデルドキュメントのセクションから開始してください。提案された変更をリンク先のPR gh-120942、gh-122178、gh-141124と比較してください。getitem、スライシング、反復、reversedプロトコルについて列挙された動作が正確に文書化され、古いループに関する注記が解決されていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- documentation
- issue の種類
- ドキュメント
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100