[Python-ideas] Propagating StopIteration value

Richard Oudkerk shibturn at gmail.com
Sun Oct 7 21:18:37 CEST 2012

On 07/10/2012 8:06pm, Serhiy Storchaka wrote:
> I propose make it equivalent to:
>    def chain(*iterables):
>        value = None
>        for it in iterables:
>            value = yield from it
>        return value

That means that all but the last return value is ignored.  Why is the 
last return value any more important than the earlier ones?

ISTM it would make just as much sense to do

   def chain(*iterables):
       values = []
       for it in iterables:
           values.append(yield from it)
       return values

But I don't see any point in changing the current behaviour.


More information about the Python-ideas mailing list