scared about refrences...
Neil Cerutti
horpner at yahoo.com
Mon Oct 30 14:33:45 EST 2006
On 2006-10-30, SpreadTooThin <bjobrien62 at gmail.com> wrote:
> def fn(list):
> list[1] = 0
>
> myList = [1, 2, 3]
> print myList
> fn(myList)
> print myList
>
>>>> [1,2,3]
>>>> [1,0,3]
>
> How can I avoid this? In this case this is a really simplified
> example but the effects are the same... How do I specify or
> create deep copies of objects that may contain other objects
> that may contain other object that may contain other
> objects....
See 3.18 Copy -- Shallow and deep copy operations.
--
Neil Cerutti
I pulled into a lay-by with smoke coming from under the bonnet. I
realized the car was on fire so took my dog and smothered it with a
blanket. --Insurance Claim Blooper
More information about the Python-list
mailing list