Would like some thoughts on a grouped iterator.

Jussi Piitulainen jussi.piitulainen at helsinki.fi
Mon Sep 5 06:56:11 EDT 2016


Peter Otten writes:

> Jussi Piitulainen wrote:

[- -]

>>     while more:
>>         yield gp()

[- -]

> As usual I couldn't stop and came up with something very similar:

[- -]

>     while more:
>         g = group()
>         yield g
>         for _ in g: pass

[- -]

> The one thing I think you should adopt from this is that the current
> group is consumed before yielding the next.

Oh yes. I see now that it's also easy to do so.



More information about the Python-list mailing list