
May 22, 2008
4:22 p.m.
Facundo Batista wrote:
I couldn't answer why, so I'm asking here...Is it because the reference counting will be complicated? Is it because it'd be inefficient in other way? It's something else? Or is something that could be done... but is not done yet?
If we changed Python to slice-by-reference, then tomorrow someone would be asking why it isn't slice-by-copy. There are pros and cons to both that are dependent on your application. It's not hard to imagine applications where you want to hold onto a small portion of a large string, thereby forcing the entire string to remain in memory. If a slices had a copy method, then I suppose this would be moot. -Scott -- Scott Dial scott@scottdial.com scodial@cs.indiana.edu