file reading by record separator (not line by line)

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


--- Tijs <tijs_news at bluescraper.nl> 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
cumbersome.

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. 
http://mobile.yahoo.com/go?refer=1GNXIC



More information about the Python-list mailing list