Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76290
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <kwatch@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.04; 'syntax': 0.04; "subject:' ": 0.07; 'ex:': 0.09; 'pep': 0.09; 'try:': 0.09; 'val': 0.09; '7:35': 0.16; 'propagated': 0.16; 'subject:yield': 0.16; 'url:peps': 0.16; 'xs:': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'subject:] ': 0.20; 'thanks.': 0.20; 'seems': 0.21; 'aug': 0.22; 'email addr:gmail.com>': 0.22; 'to:name :python-list@python.org': 0.22; 'of.': 0.24; 'url:dev': 0.24; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; 'url:python': 0.33; 'cases': 0.33; 'subject:from': 0.34; 'except': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; '14,': 0.36; 'edge': 0.36; 'yield': 0.36; 'url:org': 0.36; 'too': 0.37; 'thank': 0.38; 'to:addr:python-list': 0.38; 'skip:- 10': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'read': 0.60; 'simply': 0.61; 'simple': 0.61; 'you.': 0.62; 'more': 0.64; 'different': 0.65 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Q8fjUIRTWZqP5fSrL2qBmN1oZx836G4xJVcExntQ8rE=; b=uotN9KS5LMhPTXRLO0iGTFDD9v+rfWwxwOCFJcKvGO1giVmdyc85Mo8wJycxOT2XOu 5q0prNeAe3cq3vGGejpTGwf8t8f2J2y6v44y9hkaJRSbY1FQbteZvXpv51qZbZr+bq9H dypxGx70+inq2JC1An9dVCJAOX68/BtYMSBys76X3qMHZY1+vFp3YAaPGwkWobxKXzOE 5EIr44VkHITTqUSUmmyThrt/93suepjKZE5KLlnOSii51HvJNMHZlqO0Oxd92sTl+geM R1BFfzaN0VSTkCQ1UhwbdRKP+L0rDLxrV3Dyz3QDrk64kTZxhlpDmI4163IOF60mZHjF f6Qw== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.57.68 with SMTP id g4mr57332499igq.48.1408010365981; Thu, 14 Aug 2014 02:59:25 -0700 (PDT) |
| In-Reply-To | <CAPTjJmo-0aqxeosa1bM=jtuAdwoZLiiG20kDp7RGvP3Zx65_9w@mail.gmail.com> |
| References | <CAFTm5Ru8nfNt2UtyeBiEh-7Cf5RQZShYV9ha=6HACifCcVUG4w@mail.gmail.com> <CAPTjJmo-0aqxeosa1bM=jtuAdwoZLiiG20kDp7RGvP3Zx65_9w@mail.gmail.com> |
| Date | Thu, 14 Aug 2014 18:59:25 +0900 |
| Subject | Re: [Q] is 'yield from' syntax sugar for 'for'+'yield'? |
| From | Makoto Kuwata <kwatch@gmail.com> |
| To | "python-list@python.org" <python-list@python.org> |
| Content-Type | multipart/alternative; boundary=047d7bdc0d9eb45e82050093f5c7 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.12990.1408010368.18130.python-list@python.org> (permalink) |
| Lines | 92 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1408010368 news.xs4all.nl 2967 [2001:888:2000:d::a6]:43653 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:76290 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On Thu, Aug 14, 2014 at 6:38 PM, Chris Angelico <rosuav@gmail.com> wrote:
> On Thu, Aug 14, 2014 at 7:35 PM, Makoto Kuwata <kwatch@gmail.com> wrote:
> > I understand that::
> >
> > yield from xs
> >
> > is syntax suger of::
> >
> > for x in xs:
> > yield x
>
> Not just. It's like that for simple cases, but there are edge cases
> that are much more complicated to do manually, and are simply taken
> care of. Best would be to read the PEP itself:
>
> http://www.python.org/dev/peps/pep-0380/
>
> ChrisA
>
Thank you. It seems too complicated...
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
Thanks.
--
regards,
kwatch
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [Q] is 'yield from' syntax sugar for 'for'+'yield'? Makoto Kuwata <kwatch@gmail.com> - 2014-08-14 18:59 +0900 Re: [Q] is 'yield from' syntax sugar for 'for'+'yield'? Marko Rauhamaa <marko@pacujo.net> - 2014-08-14 13:32 +0300
csiph-web