[Python-ideas] yield from multiple iterables (was Re: The async API of the future: yield-from)

Steven D'Aprano steve at pearwood.info
Sun Oct 14 21:14:19 CEST 2012


On 15/10/12 03:15, Eric Snow wrote:
> On Oct 14, 2012 8:42 AM, "Guido van Rossum"<guido at python.org>  wrote:
>> Sadly it looks that
>>
>>    r = yield from (f1(), f2())
>>
>> ends up interpreting the tuple as the iterator, and you end up with
>>
>>    r = (f1(), f2())
>>
>> (i.e., a tuple of generators) rather than the desired
>>
>>   r = ((yield from f1()), (yield from f2()))

How about this?

r = yield from *(f1(), f2())


which currently is a SyntaxError in 3.3.



-- 
Steven



More information about the Python-ideas mailing list