[Python-ideas] + operator on generators

Cameron Simpson cs at zip.com.au
Fri Jun 30 20:17:40 EDT 2017


On 26Jun2017 23:26, Koos Zevenhoven <k7hoven at gmail.com> wrote:
>I sometimes wish there was something like
>
>c from:
>    yield from a
>    yield from b

Nice.

>​...or to get a list:
>
>c as list from:
>    yield from a
>    yield from b
>
>...or a sum:
>
>c as sum from:
>    yield from a
>    yield from b
>
>These would be great for avoiding crazy oneliner generator expressions.

Also nice, but for me a nonstarter because it breaks the existing pythyon idion 
that "... as foo" means to bind the name "foo" as the expression on the left.  
Such as with import, except.

So +1 for the form, -1 for the particular keyword.

Cheers,
Cameron Simpson <cs at zip.com.au>

Trust the computer industry to shorten Year 2000 to Y2K. It was this thinking 
that caused the problem in the first place.
- Mark Ovens <marko at uk.radan.com>


More information about the Python-ideas mailing list