On Wed, Jun 28, 2017 at 11:54 AM, Paul Moore <p.f.moore@gmail.com> wrote:
Indeed. I don't recall *ever* using itertools.chain myself. 
In fact, me neither. Or maybe a couple of times. For such a basic task, it feels more natural to write a generator function, or even turn it into a list, if you can be sure that the 'unnecessary' lists will be small and that the code won't be a performance bottle neck.

To reiterate on this some more: One of the nice things of Python 3 is (or could be) the efficiency of not making unnecessary lists by default. But for the programmer/beginner it's not nearly as convenient with the views as it is with lists. Beginners quickly need to learn about  

Also generators are really nice, and chaining them is just as useful/necessary as extending or concatenating lists. Chaining generators with other iterables is certainly useful, but when all the parts of the chained object are iterable but not sequences, that seems like an invitation to use list() at some point in the code.

So whatever the outcome of this discussion (I hope there is one, whether it is by adding iterator-related builtins or something more sophisticated), it should probably take into account possible future ways of dealing with some kind of "lazy lists". However, I'm actually not sure the syntax of chaining generators/iterables should necessarily be the same as for chaining arbitrary sequences. The programmer needs to be well aware of whether the resulting object is a Sequence or 'just' a generator.

-- Koos

--
+ Koos Zevenhoven + http://twitter.com/k7hoven +