function calls ...

Sean 'Shaleh' Perry shalehperry at
Tue Aug 20 20:40:02 CEST 2002

On 20-Aug-2002 Axel Bock wrote:
> Hi, 
> as you all might know :-) function calls are always done "by reference",
> like the C programmers would say.
> Now I have a special problem: I have a dictionary, and I have a function.
> And I want to call the function with the dictionary as parameter, but I
> want a *COPY* of the dictionary be transferred, cause the function makes
> changes to this one which I don't like to keep but are nonetheless
> neccessary.
> With lists it works like this:
>       callme(list[:])
> but with dictionaries ... ?
> can anyone help please?

import copy
copy.deepcopy() # works on list, dicts, etc.

More information about the Python-list mailing list