How to copy by reference, only some list items in python

Supoose I have a python list a = [0,1,2,3,4,5]. Now I need to make the list bin such a way that it bshould contain elements [1,2,3], but as a link to a. By this, I mean that if I changed a[1] = 3, then b[0]it should also be 3. How can i achieve this?

from what I know, with the help b = aI can have a copy by reference, but only with a complete list is possible, and if I do b = a[1:4], then this is a separate copy.

+4
source share

No one has answered this question yet.


All Articles