A simple generator application

Doug Fort doug.fort at verizon.net
Sat Oct 12 13:16:31 EDT 2002


I'm interested in generators. I've read Dr. David Mertz's 'Charming
Python' articles (http://gnosis.cx/publish/tech_index_cp.html), and 
the discussion here on c.l.p. 

I've been looking for an excuse to actually use a generator. I need to put
include guards on a bunch of C++ header files. So I started out to create
a generator that does what os.path.walk does, with yield in place of the
callback 'visitor' function.

It turned out to be not that simple; but Ive attached what I've got. I
feel that this is worth cluttering up the group with because it's simple
enough to grasp, but it actually does something.

Since this is a new way of thinking for me, I'm interested in how this
task cold be done more cleanly.
-- 
Doug Fort, Programmer
http:/www.dougfort.net




More information about the Python-list mailing list