If you use string.split() on a Python string, it returns a list of strings. These substrings that have been split-out are copies of their part of the parent string.
Is it possible to instead get some cheaper slice object that holds only a reference, offset and length to the bits split out?
And is it possible to have some ‘string view’ to extract and treat these sub-strings as if they are strings yet without making a copy of their bytes?
(I ask as I have very large strings I want to slice and am running out of memory occasionally; removing the copies would be a cheap profile-guided win.)
bufferwill give you a read-only view on a string.