like a "for loop" for a string

bearophileHUGS at bearophileHUGS at
Mon Aug 18 22:02:33 CEST 2008

Fredrik Lundh:
> or you could use re.finditer, which can be used for a lot more than just
> splitting.

Having implemented some of them (and even invented algorithms like a
new substring search, that I have appreciated) you know that string
methods are simpler ways to efficiently perform specialized functions
that are used often. Many string methods can be replaced by operations
with REs, but they become less easy/clean to use, and maybe even
slower. A specialized xsplit can be faster than re.finditer, and the
syntax is better/handier.


More information about the Python-list mailing list