enumerate and filter documentation should explicitly mention that they accept any iterable
#101027
Labels
docs
Documentation in the Doc dir


The documentation of
enumerate(iterable, start=0)currently reads:This wording dates back to 2002 (commit 38f7197) with minimal changes ('the values obtained' was originally 'the corresponding value obtained', which was slightly more accurate in my opinion). An earlier issue about this paragraph can be found at #66914, though the specific issue at hand, the description of iterable's type, was not really discussed there.
While the parameter name indicates that
enumerateaccepts any iterable as the first argument, I find it strange that the description explicitly listsinstead of/without actually mentioning 'iterable' and referencing the term's definition in the glossary.
My primary suggestion is to replace (the slightly vague, as it could mean iterable or iterator) 'object which supports iteration' with 'iterable' and a link to the glossary. Additionally, since all iterators are iterables, their mention could also be removed.
Suggestion 1 (with or without a link for 'iterator'):
Suggestion 2:
filterhas a similar situation:'A container which supports iteration' is quite vague and mildly misleading since other parts of the documentation use the term 'container' for lists and similar types. It also uses 'may' instead of 'must'. I would suggest to use the same wording there as for
enumerate.The text was updated successfully, but these errors were encountered: