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

From Marko Rauhamaa <marko@pacujo.net>
Newsgroups comp.lang.python
Subject Re: [Q] is 'yield from' syntax sugar for 'for'+'yield'?
Date 2014-08-14 12:57 +0300
Organization A noiseless patient Spider
Message-ID <87y4urtmvi.fsf@elektro.pacujo.net> (permalink)
References <mailman.12988.1408008940.18130.python-list@python.org>

Show all headers | 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