[Python-ideas] Generators' and iterators' __add__ method
anatoly techtonik
techtonik at gmail.com
Thu Feb 16 08:04:54 CET 2012
On Thu, Feb 16, 2012 at 4:46 AM, Greg Ewing <greg.ewing at canterbury.ac.nz>wrote:
> 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.
Good example for Python Ideas FAQ.
--
anatoly t.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120216/43987877/attachment.html>
More information about the Python-ideas
mailing list