I'm a python newbie. It seems the slice operation will do copy. for example: >>> a = [1,2,3,4,5,6,7,8,9,0] >>> b = a[7:] >>> b [8, 9, 0] >>> a.remove(9) >>> a [1, 2, 3, 4, 5, 6, 7, 8, 0] >>> b [8, 9, 0]
if the list have large members, the slice operations will consume many times. for instance, I have a long string named it as S, the size is more than 100K I want to parser it one part-to-part. first, I process the first 100 byte, and pass the remainder to the next parser function. I pass the S[100:] as an argument of the next parser function. but this operation will cause a large bytes copy. Is there any way to just make a reference to the remainder string not copy?
-- http://mail.python.org/mailman/listinfo/python-list