[Python-ideas] Fwd: Fwd: unpacking generalisations for list comprehension
Sjoerd Job Postmus
sjoerdjob at sjoerdjob.com
Fri Oct 14 03:33:11 EDT 2016
On Fri, Oct 14, 2016 at 07:06:12PM +1300, Greg Ewing wrote:
> Sjoerd Job Postmus wrote:
> >I think the suggested spelling (`*`) is the confusing part. If it were
> >to be spelled `from ` instead, it would be less confusing.
>
> Are you suggesting this spelling just for generator
> comprehensions, or for list comprehensions as well?
> What about dict comprehensions?
For both generator, list and set comprehensions it makes sense, I think.
For dict comprehensions: not so much. That in itself is already sign
enough that probably the */** spelling would make more sense, while also
allowing the `yield *foo` alternative to `yield from foo`. But what
would be the meaning of `yield **foo`? Would that be `yield
*foo.items()`? I have no idea.
More information about the Python-ideas
mailing list