[Python-ideas] Fwd: Fwd: unpacking generalisations for list comprehension

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Oct 14 03:29:28 EDT 2016


Steven D'Aprano wrote:

  So why would yield *t give us this?
> 
>     yield a; yield b; yield c
> 
> By analogy with the function call syntax, it should mean:
> 
>     yield (a, b, c)

This is a false analogy, because yield is not a function.

>>However, consider the following spelling:
>>
>>    l = [from f(t) for t in iterable]

That sentence no verb!

In English, 'from' is a preposition, so one expects there
to be a verb associated with it somewhere. We currently
have 'from ... import' and 'yield from'.

But 'from f(t) for t in iterable' ... do what?

-- 
Greg


More information about the Python-ideas mailing list