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

Yuval Greenfield ubershmekel at gmail.com
Mon Apr 8 08:43:38 CEST 2013


On Fri, Apr 5, 2013 at 12:11 PM, Wolfgang Maier <
wolfgang.maier at biologie.uni-freiburg.de> wrote:

> Tom Schumm <phong at ...> writes:
>
> >
> > Should Python strings (and byte arrays, and other iterables for that
> > matter) have an iterator form of find/rfind (or index/rindex)?
>
> +1 as well.
> As you say, it's a logical thing to have, and there don't seem to be any
> disadvantages to it.
>
> Wolfgang
>
>
>

I think there is a disadvantage:

* It adds complexity to the str/bytes API.
* These features exist in the `re` module, TSBOOWTDI.
* Strings are usually short and always entirely in memory - the iterator
requirement isn't commonplace.

Yuval
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130408/1cc72a9e/attachment.html>


More information about the Python-ideas mailing list