On 05/18/2015 09:49 PM, Ian Kelly wrote:
It may be possible that lists in CPython could be made to share their
internal arrays with other lists on a copy-on-write basis, which could
allow slicing to be O(1) as long as neither list is modified while the
array is being shared. I expect this would be a substantial piece of
work, and I don't know if it's something that anybody has looked into.

Isn't Numpy doing this (not sure, not a python nor a numpy expert):

>>> import numpy as np
>>> a = np.array([1,2,3,4])
>>> b = a[1:]
>>> b[0] = 9
>>> a
array([1, 9, 3, 4])


Fabien
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to