> This makes me realize that `str.indexes(char)` is actually not what I need, 
> but really a `str.line_offsets()` which returns exactly the positions that 
> `str.splitlines()` would use. Does that make sense?

I'm also thinking of a generic `str.split_indices(char)` that handles all 
characters like `str.split(char)`, though I can't find any good use cases for 
it, so I won't recommend it for now. `str.line_offsets()` does seem like a good 
idea to me though.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/FQSJCFADMWJNPCI3KC7XUWGFKWGHSIXU/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to