Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107423
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ethan Furman <ethan@stoneleaf.us> |
| Newsgroups | comp.lang.python |
| Subject | Re: PEP proposal: sequence expansion support for yield statement: yield * |
| Date | Wed, 20 Apr 2016 13:01:35 -0700 |
| Lines | 29 |
| Message-ID | <mailman.38.1461182430.12923.python-list@python.org> (permalink) |
| References | <573e61523bfc412ca8674b06d70f2fd7@sraex01sc.sisa.samsung.com> <5717E01F.3020804@stoneleaf.us> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de Yxllj4igpif2Var/GkGE9Ax/5gCTA/zfjSVj7vkecvZQ== |
| Return-Path | <ethan@stoneleaf.us> |
| 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:PEP': 0.07; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'semantics': 0.09; 'python': 0.10; 'syntax': 0.13; 'argument': 0.15; '*sequence': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'sequence:': 0.16; 'subject:yield': 0.16; 'which,': 0.16; 'wrote:': 0.16; 'working.': 0.18; '(the': 0.22; 'subject:support': 0.22; 'elements': 0.23; 'slightly': 0.23; 'examples': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'expansion': 0.27; 'opposed': 0.27; 'sequence': 0.27; 'yield': 0.27; '~ethan~': 0.29; 'typically': 0.29; 'url:mailman': 0.30; '[1]': 0.32; 'url:python': 0.33; 'common': 0.33; 'url:listinfo': 0.34; 'clear': 0.35; 'follows:': 0.35; 'propose': 0.35; 'but': 0.36; 'should': 0.36; 'url:org': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'mean': 0.38; 'url:mail': 0.40; 'to:addr:python.org': 0.40; 'your': 0.60; 'behavior': 0.61; 'charset:windows-1252': 0.62; 'different': 0.63; 'results': 0.66; 'ideas.': 0.84; 'subject: *': 0.84 |
| User-Agent | Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
| In-Reply-To | <573e61523bfc412ca8674b06d70f2fd7@sraex01sc.sisa.samsung.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| 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> |
| X-Mailman-Original-Message-ID | <5717E01F.3020804@stoneleaf.us> |
| X-Mailman-Original-References | <573e61523bfc412ca8674b06d70f2fd7@sraex01sc.sisa.samsung.com> |
| Xref | csiph.com comp.lang.python:107423 |
Show key headers only | View raw
On 04/20/2016 12:34 PM, Ken Seehart wrote:
New ideas for Python are typically vetted on Python Ideas. [1]
> Currently the common pattern for yielding the elements in a sequence
> is as follows:
>
> for x in sequence: yield x
>
> I propose the following replacement (the result would be identical):
>
> yield *sequence
>
> The semantics are somewhat different from argument expansion (from
> which the syntax is borrowed), but intuitive: yield all of the elements
> of a sequence (as opposed to yield the sequence as a single item).
Your examples do not make clear what your result should be. If you mean
the results are exactly the same you can get that behavior with
yield from iter(x)
which, while being slightly longer, has the advantage of already
working. ;)
--
~Ethan~
[1] https://mail.python.org/mailman/listinfo/python-ideas
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: PEP proposal: sequence expansion support for yield statement: yield * Ethan Furman <ethan@stoneleaf.us> - 2016-04-20 13:01 -0700
Re: PEP proposal: sequence expansion support for yield statement: yield * kenseehart@gmail.com - 2016-04-20 15:26 -0700
Re: PEP proposal: sequence expansion support for yield statement: yield * Chris Angelico <rosuav@gmail.com> - 2016-04-21 09:23 +1000
csiph-web