Inconsistent list/pointer problem

Gabriel Genellina gagsl-py at yahoo.com.ar
Thu Feb 1 15:09:37 EST 2007


En Thu, 01 Feb 2007 10:23:16 -0300, Doug Stell <celiadoug at mchsi.com>  
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, 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.
>
> def myFunc(listA):
>     listB = listA
>     work on & modify listB
>     return(listB)

This article will help you understanding this behavior:
http://effbot.org/zone/python-objects.htm

-- 
Gabriel Genellina




More information about the Python-list mailing list