Hello, this issue is solved, no help needed.
Gtx Carl. ----- Forwarded by Carl Wolff/IT/NL/Imtech on 06-12-2006 10:51 ----- Carl Wolff/IT/NL/Imtech wrote on 05-12-2006 22:55:20: > Hello > > question about copy vs deepcopy used in multithreaded context: > > suppose the following program below: > > the original dictionary is modified after the thread is started, the > thread works on a copied and deepcopied version of the original > dictionary. Is the dictionary named "originalcopy" isolated from > changes in original in multithreaded context? > > The program reports no errors but I want to be really sure about this > > Thanks > Carl. > > > > > <snip> > > original = {} > originalcopy = {} > originaldeepcopy = {} > > class checker(threading.Thread): > def __init__(self): > threading.Thread.__init__(self) > pass > def run(self): > while True: > for i in originaldeepcopy: > if originalcopy[i] == originaldeepcopy[i]: > pass > else: > print "error", originalcopy[i], "Not equal to", originaldeepcopy[i] > > i = 0 > while i<1000: > original[i] = i > i = i + 1 > > originalcopy = copy.copy(original) > originaldeepcopy = copy.deepcopy(original) > > test = checker() > test.start() > > time.sleep(0.5) > > while True: > i = 0 > while i<1000: > original[i] = i*2 > i = i + 1
-- http://mail.python.org/mailman/listinfo/python-list