Python 3000 idea -- + on iterables -> itertools.chain

Georg Brandl g.brandl-nospam at gmx.net
Mon Nov 13 11:30:54 EST 2006


Carl Banks wrote:
> Georg Brandl wrote:
>> What has a better chance of success in my eyes is an extension to yield
>> all items from an iterable without using an explicit for loop: instead of
>>
>> for item in iterable:
>>      yield item
>>
>> you could write
>>
>> yield from iterable
>>
>> or
>>
>> yield *iterable
> 
> Since this is nothing but an alternate way to spell a very specific
> (and not-too-common) for loop, I expect this has zero chance of
> success.

well, it could also be optimized internally, i.e. with a new opcode.

Georg



More information about the Python-list mailing list