re: Inconsistent list/pointer problem

2007-02-02 Thread Eduardo \"EdCrypt\" O. Padoan
> 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

Re: Inconsistent list/pointer problem

2007-02-02 Thread Bruno Desthuilliers
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

Inconsistent list/pointer problem

2007-02-02 Thread Eduardo \"EdCrypt\" O. Padoan
> 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

Re: Inconsistent list/pointer problem

2007-02-01 Thread Gabriel Genellina
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

Re: Inconsistent list/pointer problem

2007-02-01 Thread Bruno Desthuilliers
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

Re: Inconsistent list/pointer problem

2007-02-01 Thread Richard Brodie
"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

Re: Inconsistent list/pointer problem

2007-02-01 Thread bearophileHUGS
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

Inconsistent list/pointer problem

2007-02-01 Thread Doug Stell
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