grokking generators and iterators
Bob Horvath
usenet at horvath.com
Sat May 11 01:40:44 EDT 2002
We have a document repository at work whose "database" is a flat text
file. The search engine on it is lame, and I want to create a better
one, but I need to work with the format that exists. Having recently
learned about generators, I thought it might be a good fit,
Unfortunately, I am struggling to find an easy way to do it. I am
wondering if I just don't grok the new features, or if they aren't a
good fix.
I don't think it matters what the format is. It is a repeating pattern
of 5 lines.
How would you suggest writing a generator that spits out 5 line chunks
of a file at a time?
How would you do it without generators?
More information about the Python-list
mailing list