How can I create a pair of iterables containing the same items (not just copies, but shared memory of items) but in different order, and such that a change to an item in one of the iterables will be reflected in the other iterable?
For example:
>>> x = [0, 1, 2, 3] >>> y = [x[1], x[2], x[3], x[0]] >>> x[2] is y[1] True Great so far, but if I make a change to one of the items in an iterable, it ends up creating a new item (new memory) space, not changing the item in that same memory space.
>>> x[2] *= 5 >>> x[2] is y[1] False >>> x[2] 10 >>> y[1] 2