Question about 'yield from'.

I understand that::

    yield from xs

is syntax suger of::

    for x in xs:
      yield x

And::

    val = yield from xs

is same as::

    for x in xs:
      ret = yield x
    val = ret

Is it true? Do I understand correctly?


quote from
https://docs.python.org/3/whatsnew/3.3.html#pep-380-syntax-for-delegating-to-a-subgenerator
> For simple iterators, yield from iterable is essentially
> just a shortened form of for item in iterable: yield item:

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

Reply via email to