Problem with assigning variables of type List
abhishek at ocf.berkeley.edu
Wed Aug 21 16:06:55 CEST 2002
Max M <maxm at mxm.dk> wrote in message news:<3D633B27.50702 at mxm.dk>...
> >>> def foo(lst):
> lst.append(42) <----- Has an effect on the actual arguments
His point seems to be that inside the function you can't change the id
of the object that 'lst' points to, so in his words you can't change
the argument 'lst'. However you can mutate the object that the
argument points to, which is a different issue. By his interpretation
C is also "call by value", which seems consistent - but not how most
people put it.
More information about the Python-list