[Python-ideas] pipe function for itertools?
Bruce Frederiksen
dangyogi at gmail.com
Tue May 26 19:07:43 CEST 2009
Donald 'Paddy' McCarthy wrote:
> def pipe(*cmds):
> ....gen = cmds[0]
> ....for cmd in cmds[1:]:
> ....... gen = cmd(gen)
> ....for x in gen:
> ....... yield x
def pipe(*cmds):
....gen = cmds[0]
....for cmd in cmds[1:]:
....... gen = cmd(gen)
....return gen
Would be more efficient. And doesn't change how it's used...
-bruce frederiksen
More information about the Python-ideas
mailing list