On 2007-06-01, Tijs <[EMAIL PROTECTED]> wrote:
> Steve Howell wrote:
>>> 
>>> from blockread import BlockReader
>>> 
>>> b = BlockReader(f, boundary='>')
>>> for block in b:
>>>         # whatever
>> 
>> Yep, I like this idea.  You might have a few
>> variations:
>
> 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('>'))
>
> Maybe make variations for character-based readers and
> line-based readers.

I would prefer, "f.readlines(delim='>')" etc., a la C++
str::getline.

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

Reply via email to