`iter()` doesn't require a "collection"
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
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), andfor 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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con la forma di iter() con un argomento nella documentazione delle funzioni integrate. Esamina la formulazione relativa ai protocolli “iterable” e “sequence”, quindi conferma che il termine “collection” venga rimosso o riformulato in modo da non implicare il supporto per la dimensione e il contenimento.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 30/100