[Python-ideas] Add peekline(), peeklines(n) and optional maxlines argument to readlines()

Nick Coghlan ncoghlan at gmail.com
Tue Oct 4 20:06:26 CEST 2011


On Tue, Oct 4, 2011 at 1:59 PM, Eli Bendersky <eliben at gmail.com> wrote:
> This is useful, and made simpler by contextlib.contextmanager.

Yeah, the only reason I wrote it out by hand is that if it *did* go
into the io module, we wouldn't want to depend on contextlib for it.
However, as Antoine pointed out, it only works for seekable streams
and probably isn't general purpose enough to actually be included in
the io module.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list