Does this always go right

Gabriel Genellina gagsl-py at yahoo.com.ar
Tue Dec 5 16:27:57 EST 2006


At Tuesday 5/12/2006 12:04, Carl.Wolff at imtech.nl wrote:

>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

For your simple test dictionary, copy and deepcopy behaves 
identically. If you wish, you should test using values that are 
containers themselves.
With or without threads, modifying original (with the current 
contents) would never modify originalcopy neither originaldeepcopy, 
so you aren't testing anything here.
Try rewriting your test.


-- 
Gabriel Genellina
Softlab SRL 

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar



More information about the Python-list mailing list