I am trying to implement a queue to share some objects between processes in Python (for example a list). However, what I put in the queue is a different object from what I get afterwards:
from multiprocessing import Queue
q = Queue()
a = [1,2,3]
print(id(a)) # prints 4389597128
q.put(a)
b = q.get()
print(id(b)) # prints 4389600080
This does not happen if I use atomic elements, such as numbers.
Why is this the case? How can I put and get the same object into the queue?