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. Perhaps this has been suggested before. The string methods could transparently work on such PyStringRefObjects, and any extensions that were polite enough to use only the Python API for playing with strings could continue to work fine; but things which directly manipulated the ob_sval field would break. Perhaps a possibility for Python 3K? Anyway -- as a solution for your particular problem, Fredrik, the PySliceListObject sounds like a good idea. -- ?!ng "To be human is to continually change. Your desire to remain as you are is what ultimately limits you." -- The Puppet Master, Ghost in the Shell
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