[Python-Dev] Some RFE for review

Oren Tirosh oren.tirosh at gmail.com
Mon Jun 27 17:40:55 CEST 2005


On 6/27/05, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Reinhold Birkenfeld wrote:
> > 1152248:
> > In order to read "records" separated by something other than newline, file objects
> > should either support an additional parameter (the separator) to (x)readlines(),
> > or gain an additional method which does this.
> > Review: The former is a no-go, I think, because what is read won't be lines.
> > The latter is further complicating the file interface, so I would follow the
> > principle that not every 3-line function should be builtin.
> 
> As Douglas Alan's sample implementation (and his second attempt [1])
> show, getting this right (and reasonably efficient) is actually a
> non-trivial exercise. Leveraging the existing xreadlines
> infrastructure is an idea worth considering.

Do you mean the existing xreadlines infrustructure that no longer
exists since 2.4 ?  :-)

An infrastructure that could be leveraged is the readahead buffer used
by the file object's line iterator.

  Oren


More information about the Python-Dev mailing list