proposed PEP: iterator splicing
Paul Rubin
http
Sun Apr 15 01:17:08 EDT 2007
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_gen():
...
yield *some_other_gen()
comes to mind. Less clutter, and avoids yet another temp variable
polluting the namespace.
Thoughts?
More information about the Python-list
mailing list