Especialized generator
Aahz
aahz at pythoncraft.com
Thu Mar 4 06:30:28 EST 2004
In article <hltd409mao1mmlk6kn5rjk00i5342p8pk6 at 4ax.com>,
Boogie El Aceitoso <frr149 at telefonica.net> wrote:
>
>I want to write a generator that specializes on os.walk. It should
>yield only certain kinds of files.
>
>What's the best way of doing this? How do you save the state on the
>base generator?
You don't. You write another generator that yields appropriate results
from calling os.walk(). Chaining generators is *wonderful*.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"Do not taunt happy fun for loops. Do not change lists you are looping over."
--Remco Gerlich, comp.lang.python
More information about the Python-list
mailing list