Ka-Ping Yee wrote: > > On Sun, 27 Feb 2000, Fredrik Lundh wrote: > > here's one proposal, off the top of my head: > > > > 1. introduce a PySliceListObject, which behaves like a > > simple sequence of strings, but stores them as slices. > > It occurred to me when i read this that *all* slices > could be references within the original string, since > strings are immutable. That is, > > s[x:y] > > could return a PyStringRefObject that behaves just like > a string, but contains a length y - x and a pointer to > &(s->ob_sval) + x instead of the character data itself. > The creation of this PyStringRefObject would increment > the reference count of s by 1. The general approach is "cords" (in Hans Boehm's GC, garbage-collected), and "ropes" (in SGI's STL, http://www.sgi.com/Technology/STL/Rope.html, reference-counted). It's a great idea, IMO. Why create and copy strings all the time? -jcw
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4