[Python-ideas] Introduce collections.Reiterable

Terry Reedy tjreedy at udel.edu
Thu Sep 19 12:31:12 CEST 2013


On 9/19/2013 4:59 AM, Neil Girdhar wrote:
> Well, generators are iterable, but if you write a function like:
>
> def f(s):
>       for x in s:
>               do_something(x)
>       for x in s:
>               do_something_else(x)

This strikes me as bad design. It should perhaps a) be two functions or 
b) take two iterable arguments or c) jam the two loops together.

-- 
Terry Jan Reedy



More information about the Python-ideas mailing list