Inconsistent list/pointer problem

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Fri Feb 2 06:20:38 EST 2007


Eduardo "EdCrypt" O. Padoan a écrit :
>> def myFunc(listA):
>>     listB = listA
>>     work on & modify listB
>>     return(listB)
> 
> def my_func(listA):
>   listB = listA[:]
>   #work on & modify listB
>   return listB


Won't do for the OP's needs - he wants to modify the objects contained 
in listB without impacting the ones in listA (or at least that's what I 
understand).




More information about the Python-list mailing list