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


Groups > comp.lang.python > #107458

Re: PEP proposal: sequence expansion support for yield statement: yield *

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: PEP proposal: sequence expansion support for yield statement: yield *
Date 2016-04-22 01:26 +1000
Message-ID <mailman.19.1461252410.23626.python-list@python.org> (permalink)
References <573e61523bfc412ca8674b06d70f2fd7@sraex01sc.sisa.samsung.com> <mailman.36.1461181657.12923.python-list@python.org> <57181d0e$0$1591$c3e8da3$5496439d@news.astraweb.com> <CAO1D73Fs6_U95TKsmytdH3wgnyUgrZHcaCk5J6xL__xia6U0Ww@mail.gmail.com> <CAPTjJmq86WzrEX++hfGRaTfs6XUf+pxF2XdxKKanh58q1AXzGA@mail.gmail.com>

Show all headers | View raw


On Fri, Apr 22, 2016 at 1:19 AM, justin walters
<walters.justin01@gmail.com> wrote:
> I agree with the others that the new syntax is not needed.
>
> I would also like to point out that I believe any new added syntax or
> functionality should avoid the use of '*' and '**' as both of these
> characters are already used for many things such as optional arguments and
> mathematical operators. Adding more uses for said characters only decreases
> the readability of the code.

The single asterisk is used for packing and unpacking, though. See PEP
448 [1] for some of the ways this can be used (in the context of "the
ways this can NOW be used in Python 3.5"). So the proposed "yield
*sequence" does make good sense; however, "yield from" has, as Steven
pointed out, *far* more detailed semantics, as it basically allows
generators to be refactored, with all their semantics (yield, send,
throw, return).

ChrisA

[1] https://www.python.org/dev/peps/pep-0448/

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


Thread

PEP proposal: sequence expansion support for yield statement: yield * Ken Seehart <k.seehart@partner.samsung.com> - 2016-04-20 19:34 +0000
  Re: PEP proposal: sequence expansion support for yield statement: yield * Steven D'Aprano <steve@pearwood.info> - 2016-04-21 10:21 +1000
    Re: PEP proposal: sequence expansion support for yield statement: yield * justin walters <walters.justin01@gmail.com> - 2016-04-21 08:19 -0700
    Re: PEP proposal: sequence expansion support for yield statement: yield * Chris Angelico <rosuav@gmail.com> - 2016-04-22 01:26 +1000

csiph-web