On Thu, Aug 14, 2014 at 7:59 PM, Makoto Kuwata <kwa...@gmail.com> wrote:
> I understand that 'val = yield from xs' is completely different from::
>
>    for x in xs:
>       ret = yield x
>    val = x
>
> Return value is propagated by StopIteration, like:
>
>    it = iter(xs)
>    try:
>      while 1:
>        yield next(it)
>    except StopIteration as ex:
>      val = ex.value

It's even more complicated than that. The PEP specifies the exact semantics.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to