[Q] is 'yield from' syntax sugar for 'for'+'yield'?
Makoto Kuwata
kwatch at gmail.com
Thu Aug 14 05:35:36 EDT 2014
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140814/20b40c4c/attachment.html>
More information about the Python-list
mailing list