On Jun 1, 7:00 am, Steve Howell <[EMAIL PROTECTED]> wrote:
> --- Tijs <[EMAIL PROTECTED]> 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.

I'm afraid I beat you to it :)

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/521877

George

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to