Re: proposed PEP: iterator splicing

2007-04-15 Thread Georg Brandl
Steven Bethard schrieb: > Paul Rubin wrote: >> The boilerplate >> >> def some_gen(): >>... >>for x in some_other_gen(): >>yield x >>... >> >> is so common (including the case where some_other_gen is the same as >> some_gen, i.e. it's a recursive call) t

Re: proposed PEP: iterator splicing

2007-04-15 Thread Anton Vredegoor
Kay Schluehr wrote: > Maybe you should start by developing a design pattern first and > publish it in the Cookbook. I have the fuzzy impression that the idea > you are after, requires more powerfull control structures such as > delimited continuations that are beyond ths scope of Pythons simple >

Re: proposed PEP: iterator splicing

2007-04-15 Thread Kay Schluehr
On Apr 15, 10:23 am, Anton Vredegoor <[EMAIL PROTECTED]> wrote: > I'm currently also fascinated by the new generator possibilities, for > example sending back a value to the generator by making yield return a > value. What I would like to use it for is when I have a very long > generator and I nee

Re: proposed PEP: iterator splicing

2007-04-15 Thread Steven Bethard
Paul Rubin wrote: > The boilerplate > > def some_gen(): >... >for x in some_other_gen(): >yield x >... > > is so common (including the case where some_other_gen is the same as > some_gen, i.e. it's a recursive call) that I find myself wanting > a more d

Re: proposed PEP: iterator splicing

2007-04-15 Thread Anton Vredegoor
Paul Rubin wrote: > def some_gen(): >... >yield *some_other_gen() > > comes to mind. Less clutter, and avoids yet another temp variable > polluting the namespace. > > Thoughts? Well, not directly related to your question, but maybe these are some ideas that would help dete

Re: proposed PEP: iterator splicing

2007-04-15 Thread Paul Rubin
John Nagle <[EMAIL PROTECTED]> writes: > > Less clutter, and avoids yet another temp variable polluting the namespace. > Are we in danger of running out of temp variables? There is unfortunately no way to contain the scope of a loop index to the inside of the loop. Therefore introducing more

Re: proposed PEP: iterator splicing

2007-04-14 Thread Carsten Haese
On 14 Apr 2007 22:17:08 -0700, Paul Rubin wrote > The boilerplate > > def some_gen(): >... >for x in some_other_gen(): >yield x >... > > is so common (including the case where some_other_gen is the same as > some_gen, i.e. it's a recursive call) that I find

Re: proposed PEP: iterator splicing

2007-04-14 Thread John Nagle
Paul Rubin wrote: > Less clutter, and avoids yet another temp variable > polluting the namespace. Are we in danger of running out of temp variables? John Nagle -- http://mail.python.org/mailman/listinfo/python-list

proposed PEP: iterator splicing

2007-04-14 Thread Paul Rubin
The boilerplate def some_gen(): ... for x in some_other_gen(): yield x ... is so common (including the case where some_other_gen is the same as some_gen, i.e. it's a recursive call) that I find myself wanting a more direct way to express it: def some_g