[Python-ideas] Generators' and iterators' __add__ method

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Feb 16 02:46:23 CET 2012


On 16/02/12 05:20, Yuval Greenfield wrote:
> Wouldn't it be nice to add generators and iterators like we can do with lists?
 >
>      for item in f() + g():
>          print(item)

No. Then every iterator would be expected to implement __add__,
including all the ones already written.

It would also clash with existing meanings of __add__ on some
types, such as NumPy arrays.

-- 
Greg



More information about the Python-ideas mailing list