[Python-3000] find -> index patch
jackdied at jackdied.com
Sun Aug 27 06:12:27 CEST 2006
On Sat, Aug 26, 2006 at 07:51:03PM -0700, Guido van Rossum wrote:
> On 8/26/06, Jack Diederich <jackdied at jackdied.com> wrote:
> > After some benchmarking find() can't go away without really hurting readline()
> > performance.
> Can you elaborate? readline() is typically implemented in C so I'm not
> sure I follow.
A number of modules in Lib have readline() methods that currently use find().
StringIO, httplib, tarfile, and others
sprat:~/src/python-head/Lib# grep 'def readline' *.py | wc -l
Mainly I wanted to point out that find() solves a class of problems that
can't be solved equally well with partition() (bad for large strings that
want to preserve the seperator) or index() (bad for large numbers of small
strings and for frequent misses). I wanted to reach the conclusion that
find() could be yanked out but as Fredrik opined it is still useful for a
subset of problems.
More information about the Python-3000