On Jan 16, 2008 1:45 PM, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On Wed, 16 Jan 2008 11:09:09 +0800, "J. Peng" <[EMAIL PROTECTED]>
>
> alist = []
> anint = 2
> astr = "Touch me"
>
> dummy(alist, anint, astr)
>
>         "dummy" can only modify the contents of the first argument -- the
> integer and string can not be mutated.

Hi,

How to modify the array passed to the function? I tried something like this:

>>> a
[1, 2, 3]
>>> def mytest(x):
...   x=[4,5,6]
...
>>> mytest(a)
>>> a
[1, 2, 3]

As you see, a was not modified.
Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to