Nested generators is the python equivalent of unix pipe cmds.
tim.hochberg at ieee.org
Fri Aug 3 16:22:16 CEST 2001
"Steven D. Majewski" <sdm7g at Virginia.EDU> wrote in message>
[Much cool generator stuff deleted]
# This is MUCH nicer than using os.path.walk() with a callback!
> ## print the first 20 gif files I can find in your cwd...
> for f in Count(Test( Files('.'), isGif ), 20 ): print f
Although I do think it would be easier to read if the order of the test and
the generator was reversed:
for f in Count(20, Test(isGif, Files('.'))): print f
I may just have a weak mind, but on the first version, I lost track of who
the 20 belonged to by the time I got to the end.
More information about the Python-list