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

Nick Coghlan ncoghlan at gmail.com
Tue Apr 9 01:09:46 CEST 2013


On 9 Apr 2013 04:20, "Antoine Pitrou" <solipsis at pitrou.net> wrote:
>
>
> Hello,
>
> On Fri, 5 Apr 2013 00:42:43 -0700
> Raymond Hettinger
> <raymond.hettinger at gmail.com> wrote:
> >
> > On Apr 4, 2013, at 6:21 PM, Tom Schumm <phong at phong.org> wrote:
> >
> > > Should Python strings (and byte arrays, and other iterables for that
matter)
> > > have an iterator form of find/rfind (or index/rindex)? I've found
myself
> > > wanting one on occasion,
> >
> > +1 from me.
> >
> > As you say, the current pattern is awkward.  Iterators are much more
> > natural for this task and would lead to cleaner, faster code.
>
> I'm mildly positive as well.
> If iterfind() / finditer() is awkward, let's call it findall(): other
> search methods just return the first match.

+0 from me for findall/rfindall. The overlap keyword-only arg seems like a
reasonable approach to that part of the problem, too.

Cheers,
Nick.

>
> Regards
>
> Antoine.
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130409/01c2492a/attachment.html>


More information about the Python-ideas mailing list