> 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).
Sorry. That is true - the items referenced on the [:] copy are the same as
in the original. Rereading what the OP msg, I think we agree
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
> def myFunc(listA):
> listB = listA
> work on & modify listB
> return(listB)
def my_func(listA):
listB = listA[:]
#work on & modify listB
return listB
Attribution makes the name t the left 'point' to the result of the
expression at the right.
In your myFunc the expersion at
En Thu, 01 Feb 2007 10:23:16 -0300, Doug Stell <[EMAIL PROTECTED]>
escribió:
> I am having a problem with the corruption of a list. It occurs only
> the first time that I call a function and never happens on subsequent
> calls. Any suggestions would be appreciated.
>
> I call the function, passi
Doug Stell a écrit :
> I am having a problem with the corruption of a list. It occurs only
> the first time that I call a function and never happens on subsequent
> calls. Any suggestions would be appreciated.
>
> I call the function, passing in a list as the input data. The function
> must manipu
"Doug Stell" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I call the function, passing in a list as the input data. The function
> must manipulate and operate on a copy of that list's data, without
> altering the list in the calling routine.
Then you will want to make a copy:
l
Doug Stell:
The standard module copy has deepcopy, it's slow but it may be a
simple solution to your problem. A better solution is to look where
data is changed and fix that.
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
I am having a problem with the corruption of a list. It occurs only
the first time that I call a function and never happens on subsequent
calls. Any suggestions would be appreciated.
I call the function, passing in a list as the input data. The function
must manipulate and operate on a copy of tha