On Sun, 11 Mar 2018 01:40:01 +0000, Ben Bacarisse wrote:

> I'm sure deep recursion is not needed, it's just tricky translating from
> a lazy language when one is not familiar with all the iterator
> facilities in Python.  For example, I couldn't find an append operation
> that returns an iterable.

The Python iterator protocol is intentionally lightweight, so there's no 
"append" operation and + is not supported.

But you can call

    it = itertools.chain(it, iterator2)

It's not often that I think Ruby's ability to monkey-patch arbitrary 
objects including built-ins is a good idea, but the ability to allow 
iterator+iterator is *almost* one of those times.



Reply via email to