[Python-ideas] An iterable version of find/index for strings?

Nick Coghlan ncoghlan at gmail.com
Mon Apr 8 10:01:10 CEST 2013


On Mon, Apr 8, 2013 at 4:58 PM, Andrew Barnert <abarnert at yahoo.com> wrote:
> This, I think, is a better point. If you need iterfind, there's a good
> chance you're going to want to replace the string with an mmap, an iterator
> around read, something that generates the string on the fly, etc. There will
> be _some_ programs for which str.iterfind is more useful than a generic
> iterfind function, but maybe not that many...

As Tom's original post shows, the existing methods are also designed
to make it relatively straightforward to implement an efficient
iterator if you do need it.

Cheers,
Nick.

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



More information about the Python-ideas mailing list