String.isplit (iterator-based split for strings)

What’s the exact API you are proposing? Is it literally just to have lazy splitting, or did you want to incorporate filtering as well?

And you can already avoid splitting over the whole string by iterating and slicing on the string yourself.

start = 0
for index, char in enumerate(str):
    if char == " ":
        substr = str[start:index]
        if match := operation(substr):
            break
        else:
            start = index + 1
1 Like