Get memory address in Python, identify if it is list or a dictionary and update its content
问题 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 Here is documentation for id() : https://docs.python.org/3/library/functions.html#id Is it possible to get reference to