If this was implemented, it is fairly straight forward to adapt this to str.split
. It is in my plan, obviously with this as a prerequisite. I would most likely look at it together with other String API changes.
I also think this is necessary, otherwise needing to work it out outside kills performance benefit for a lot of cases (especially ones of smaller size). I have experimented with Python version for a bit and it is convenient to return tuple[pos, i_needle]
in case input is a tuple
of needles.
The algorithm uses str.find
under the hood - so it is as risky as using str.find
.