Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76287
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'essentially': 0.04; 'syntax': 0.04; "subject:' ": 0.07; 'val': 0.09; 'item:': 0.16; 'iterable': 0.16; 'iterable:': 0.16; 'iterators,': 0.16; 'subject:yield': 0.16; 'url:whatsnew': 0.16; 'xs:': 0.16; 'subject:] ': 0.20; 'to:name:python-list@python.org': 0.22; 'question': 0.24; '>': 0.26; 'message-id:@mail.gmail.com': 0.30; 'url:python': 0.33; 'subject:from': 0.34; 'received:google.com': 0.35; 'yield': 0.36; 'url:org': 0.36; 'to:addr:python-list': 0.38; 'skip:- 10': 0.38; 'subject:[': 0.39; 'quote': 0.39; 'to:addr:python.org': 0.39; 'url:3': 0.61; 'simple': 0.61 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=HFiRNa+xXTpFa94o3SbWKWMrLy3VwyfMAhBFgQL4bJ8=; b=voWWzivKcATov6XdPhE6WbZPhSFaB6jL5CJSJpVZf4bfnx3ZfcZ9PlJDQBl5egbP/0 ahxvf4Xn/3e3XBVIxSX4QhX+f6To+nrsMJ6VFNamTlynWAU8sJrWiFo13KJ1+llWYUGD LbDKiMK/YNPDjW6OacZvsUdVTNhzSonb9g3Qz38kba/CG4KDbtfsYDrWWoD8W0ukJc/f gykv9jkE70Ek7iXOZaQwtE/V3OVkv2u+SBIkezl73LKTJ/VPV43jeaPGwU6AGHobyTux 245eYmjCMKbh0BNR5BTFjagxEV1uRzrH6FKW8Wfey+3+pW5cqDQnOzRfm1GMYLPqGd6P axAg== |
| MIME-Version | 1.0 |
| X-Received | by 10.43.167.196 with SMTP id nf4mr13038363icc.22.1408008936946; Thu, 14 Aug 2014 02:35:36 -0700 (PDT) |
| Date | Thu, 14 Aug 2014 18:35:36 +0900 |
| Subject | [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=001a11c2d676870478050093a024 |
| 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.12988.1408008940.18130.python-list@python.org> (permalink) |
| Lines | 59 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1408008940 news.xs4all.nl 2838 [2001:888:2000:d::a6]:37899 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:76287 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
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
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll 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