alist += [4] and alist = alist + [4] are different as the first changes the reference of alist whereas the latter doesn't. I tried this below on IDLE by using id() and it seems like it is correct claim.
Code executed on IDLE (Python 3.6.1)
>>> alist = [1, 2, 3]
>>> id(alist)
50683952
>>> alist += [4]
>>> id(alist)
50683952
>>> alist = alist + [4]
>>> id(alist)
50533080
Is it possible to get reference to memory address programatically, identify whether the location has a list or a dictionary, read the contents and update the content using reference?
NOTE: I found 2 relevant stackoverflow posts but I am not sure if they answer my question.
解决方案
You are trying to do something like in C, with a