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


Groups > comp.lang.python > #76288

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!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.04; 'syntax': 0.04; "subject:' ": 0.07; 'pep': 0.09; 'cc:addr:python- list': 0.11; '7:35': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:yield': 0.16; 'url:peps': 0.16; 'xs:': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'subject:] ': 0.20; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'of.': 0.24; 'url:dev': 0.24; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'url:python': 0.33; 'cases': 0.33; 'subject:from': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; '14,': 0.36; 'edge': 0.36; 'yield': 0.36; 'url:org': 0.36; 'pm,': 0.38; 'read': 0.60; 'simply': 0.61; 'simple': 0.61; 'more': 0.64; 'to:none': 0.92
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:cc :content-type; bh=3BZVs0SJWQkjwyPt/8IXAjhoZDgqKGClToxo6GIIZ70=; b=PP1BIY8wga95CvafqLuM5Z0yc85yR48xRYAX26QDjGAuB29QGIBwOgtMWLb+RNvRTy ktonz9E9X+sVyWwFh7FqvRnlbfqAbc8DEpamUi9aAw34LvBh6AZvyAVBWvCsZ4e3jaYT 8L5v+2yp86ez7SjQyyMd4riMBDvq0Hgi/m7q0ExNaVfh20DsAfoN/r5CgvTLBP+wxYHQ NowXpJLMn3arTB80G56K+85EzvilX1ciLGHtj9py/vN1NR9cDrZ7FXN3wTWaHibqPfkm SMOYJ0wL6TLq/c8kl+Gf4QCgc2k943Vhg+SapOT8BdpMu0g7o8USB2T2zQIvwNxtvSLp sz9w==
MIME-Version 1.0
X-Received by 10.42.216.148 with SMTP id hi20mr12501486icb.12.1408009122280; Thu, 14 Aug 2014 02:38:42 -0700 (PDT)
In-Reply-To <CAFTm5Ru8nfNt2UtyeBiEh-7Cf5RQZShYV9ha=6HACifCcVUG4w@mail.gmail.com>
References <CAFTm5Ru8nfNt2UtyeBiEh-7Cf5RQZShYV9ha=6HACifCcVUG4w@mail.gmail.com>
Date Thu, 14 Aug 2014 19:38:42 +1000
Subject Re: [Q] is 'yield from' syntax sugar for 'for'+'yield'?
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.12989.1408009125.18130.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1408009125 news.xs4all.nl 2833 [2001:888:2000:d::a6]:40578
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:76288

Show key headers only | View raw


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

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


Thread

Re: [Q] is 'yield from' syntax sugar for 'for'+'yield'? Chris Angelico <rosuav@gmail.com> - 2014-08-14 19:38 +1000

csiph-web