file reading by record separator (not line by line)

Steve Howell showell30 at
Fri Jun 1 13:00:21 CEST 2007

--- Tijs <tijs_news at> wrote:
> Yes, or a single one that takes a wide range of
> construction possibilities,
> like strings, lambdas or regexes in various keyword
> parameters.
> BlockReader(f, start='>')
> BlockReader(f, start=re.compile('>|<'), end='---')
> BlockReader(f, start=lambda x: x.startswith('>'))

Definitely.  I like your idea for regexes that you
just pass the method in, rather than the regex.  It
means fewer variations, and it also leads to slightly
more explicit code from the user, without being too

Do you have any free time on your hands?  It seems
like it would be fairly straightforward to do a quick
prototype implementation of this.  I'm off to work
soon, so I can't do it today, but maybe Sunday.

Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.

More information about the Python-list mailing list