[Python-Dev] PEP 385: the eol-type issue

M.-A. Lemburg mal at egenix.com
Thu Aug 6 13:34:24 CEST 2009

Antoine Pitrou wrote:
> M.-A. Lemburg <mal <at> egenix.com> writes:
>> What I don't understand is why the io layer tries to reinvent
>> the wheel here instead of just using the codec's .readline()
>> method - which *does* use .splitlines() and has full support
>> for all Unicode line break characters (including the CRLF
>> combination).
> As for the original Python implementation, the goal was probably to start from a
> clean sheet. Besides, the new API has seek() and tell() as well. But I'm not
> really qualified to say more -- I didn't participate in its design.
> As for the C implementation, it had to be written from scratch anyway --
> codecs.open() is pure Python and too slow. Deferring to str.splitlines() would
> still have been possible but a bit wasteful since in C you can use buffers
> directly.

Sure, but the code for line splitting is not really all that
complicated (see PyUnicode_Splitlines()), so could easily
be adapted to work on buffers directly.

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Aug 06 2009)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the Python-Dev mailing list