<div dir="ltr"><div class="gmail_quote">On Sun, Apr 4, 2010 at 7:20 PM, Masklinn <span dir="ltr"><<a href="mailto:masklinn@masklinn.net">masklinn@masklinn.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On 4 Apr 2010, at 18:58 , cool-RR wrote:<br>
><br>
> I'm still a bit confused by generators and generator expressions, but what<br>
> about making a `generator.__add__` method, that'll act like<br>
> `itertools.chain`?<br></div></div></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="h5">
</div></div>What would the use case be,</blockquote><div><br></div><div>I'm not sure I understand your question. The same use case as for `itertools,chain`: When you have several generators you want to iterate over, one after another. (True, it might be not as good when you have more than 2.)</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">and why couldn't you use itertools.chain or<br>
generator.send for that?<br>
</blockquote></div><div><br></div><div>I could use `itertools.chain`, but why type so much? I think if you have two generators, g1 and g2, then it makes sense that g1 + g2 will be an iterator that goes over the elements of both of them.</div>
<div><br></div><div>About `generator.send`, I don't understand how it's related. But I'm still new to this.</div><div><br></div><div>Ram.</div></div>