On Thu, Aug 14, 2014 at 7:02 PM, Chris Angelico <ros...@gmail.com> wrote:

> 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
>

Well, I wrote the above code in order to describe `value is propagated by
StopIteration'
because I misunderstood that it is propagated by return value of yield
statement
(see my first post).

I have known that `yield from` is very complicated (thanks to your reply).

--
regards,
kwatch
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to