Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76289

Re: [Q] is 'yield from' syntax sugar for 'for'+'yield'?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Marko Rauhamaa <marko@pacujo.net>
Newsgroups comp.lang.python
Subject Re: [Q] is 'yield from' syntax sugar for 'for'+'yield'?
Date Thu, 14 Aug 2014 12:57:05 +0300
Organization A noiseless patient Spider
Lines 17
Message-ID <87y4urtmvi.fsf@elektro.pacujo.net> (permalink)
References <mailman.12988.1408008940.18130.python-list@python.org>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info mx05.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="15281"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Mb2Dd/3aNuLwQmVlR9iBS"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
Cancel-Lock sha1:ntLagPdn2LND6y9g+pXak7Beef4= sha1:c50BmABnmO12XxR6Cl5P9kZfmKU=
Xref csiph.com comp.lang.python:76289

Show key headers only | View raw


Makoto Kuwata <kwatch@gmail.com>:

>     val = yield from xs
>
> is same as::
>
>     for x in xs:
>       ret = yield x
>     val = ret
>
> Is it true? Do I understand correctly?

The return value is not one of the yielded values. Instead, it's the
value returned by the generator/coroutine.


Marko

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[Q] is 'yield from' syntax sugar for 'for'+'yield'? Makoto Kuwata <kwatch@gmail.com> - 2014-08-14 18:35 +0900
  Re: [Q] is 'yield from' syntax sugar for 'for'+'yield'? Marko Rauhamaa <marko@pacujo.net> - 2014-08-14 12:57 +0300
  Re: [Q] is 'yield from' syntax sugar for 'for'+'yield'? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-14 23:43 +1000

csiph-web