On Jan 16, 2008 2:30 PM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 16 Jan 2008 13:59:03 +0800, J. Peng wrote: > > > 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] > > > This line does NOT modify the list [1, 2, 3]. What it does is create a > new list, and assign it to the name "x". It doesn't change the existing > list. >
Sounds strange. In perl we can modify the variable's value like this way: $ perl -le ' > $x=123; > sub test { > $x=456; > } > test; > print $x ' 456 -- http://mail.python.org/mailman/listinfo/python-list