Search substring in a string and get index of all occurances

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Wed Jun 21 09:01:01 EDT 2006


Maric Michaud:
> I'd love str implement a xsplit(sub, start, end) method, so I could have
> wrote : enumerate(s.xsplit(subs, 0, -1)).

Some of such str.x-methods (or str.i-methods, etc) can be useful
(especially for Py3.0), but keeping APIs simple and compact is very
important, otherwise when you program you have to waste some time
looking things up in the manuals. Such lists of methods are a
compromise between (among other things) completeness and compactness.

Bye,
bearophile




More information about the Python-list mailing list