How do you refer to an iterator in docs?

Terry Reedy tjreedy at udel.edu
Thu Apr 19 14:32:51 EDT 2012


On 4/19/2012 11:51 AM, Jacob MacDonald wrote:

> When I talk about an iterable, I say "iterable".

Ditto. Examples from manual:
"filter(function, iterable)
Construct an iterator from those elements of iterable for which function 
returns true."
(I would work this differently.)
"map(function, iterable, ...)
Return an iterator that applies function to every item of iterable, 
yielding the results."

> """Foo-ify some words.
>
> Arguments:
> words -- an iterable of words
>
> """

And if I mean an iterable of x, where x is a subset of Python objects, I 
say that. For example, the argument to str.join is an iterable of 
strings. Not everyone says exactly that. The manual happens to say
"str.join(iterable)
Return a string which is the concatenation of the strings in the 
iterable [in blue parameter font] iterable. A TypeError will be raised 
if there are any non-string values in iterable, including bytes objects."
But I find that slightly awkward.

Sometimes the restricted category is harder to describe. Min and max 
requires an iterable of mutually comparable objects. The first item 
determines the specific class or category. Sum requires an iterable of 
mutually addable objects, with the specific class or category (such as 
'number') again determined by the initial value.

-- 
Terry Jan Reedy




More information about the Python-list mailing list