<br><br>On Saturday, July 1, 2017, Steven D'Aprano <<a href="mailto:steve@pearwood.info">steve@pearwood.info</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, Jun 30, 2017 at 01:09:51AM +0200, Jan Kaliszewski wrote:<br>
<br>[...]<br>
<br>
But the more I think about it the more I agree with Nick. Let's start<br>
by moving itertools.chain into built-ins, with zip and map, and only<br>
consider giving it an operator after we've had a few years of experience<br>
with chain as a built-in. We might even find that an operator doesn't<br>
add any real value.</blockquote><div><br></div><div>- Would that include chain.from_iterable?</div><div>- So there's then a new conditional import (e.g. in a compat package)? What does this add? </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
> ¹ Preferably using the existing `yield from` mechanism -- because, in<br>
> case of generators, it would provide a way to combine ("concatenate")<br>
> *generators*, preserving semantics of all that their __next__(), send(),<br>
> throw() nice stuff...<br>
<br>
I don't think that would be generally useful. </blockquote><div><br></div><div>Flatten one level? </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If you're sending values<br>
into an arbitrary generator, who knows what you're getting? chain() will<br>
operate on arbitrary iterables, you can't expect to send values into<br>
chain([1, 2, 3], my_generator(), "xyz") and have anything sensible<br>
occur. </blockquote><div><br></div><div>- is my_generator() mutable (e.g. before or during iteration)?</div><div><br></div><div>- <a href="https://docs.python.org/2/reference/expressions.html#generator.send">https://docs.python.org/2/reference/expressions.html#generator.send</a></div>