python / python/cpython

`iter()` doesn't require a "collection"

オープン
#155,856 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

docs
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Documentation

The documentation for iter() says, for the one-argument form:

iter(iterable, /)

Return an iterator object. [...] the single argument must be a collection object which supports the iterable protocol (the __iter__() method), or it must support the sequence protocol (the __getitem__() method with integer arguments starting at 0). If it does not support either of those protocols, TypeError is raised.

This terminology is misleading, since a "collection" also needs to support size and containment checking. Per set and Collections Abstract Base Classes, respectively:

Like other collections, sets support x in set, len(set), and for x in set.

Collection : Sized, Iterable, Container : __contains__, __iter__, __len__

It should be possible to reword this section to avoid the term "collection", either by simply removing it or rephrasing the whole sentence.

Linked PRs
  • gh-155857

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

組み込み関数のドキュメントにある、iter() の引数を 1 つ取る形式から始めます。iterable プロトコルと sequence プロトコルに関する文言を確認し、そのうえで “collection” という用語が削除または言い換えられ、サイズと包含のサポートを意味しないことを確認します。

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

評価

技術スタック
python
領域
documentation
issue の種類
ドキュメント
難易度
1/5
見積もり時間
1時間未満
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
30/100

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

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