- Code: Select all
def xxx(data):
## has a thread method with a queue that gets data that does
time.sleep(1)
print "{}".format(data)
data={"abc":"123"}
xxx(data)
data["def"] = "fgh"
will print: {"abc":"123", "def":"fgh"}
xxx gets a pointer to data, then the main program overwrites data, since xxx has a delay of 1 sec xxx will print the additional item "def"
Karl