no pass-values calling?

J. Peng peng.kyo at gmail.com
Wed Jan 16 02:18:52 EST 2008


On Jan 16, 2008 3:03 PM, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
> On Wed, 16 Jan 2008 13:59:03 +0800, "J. Peng" <peng.kyo at gmail.com>
> declaimed the following in comp.lang.python:
>
>
> > 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]
>
>         x is unqualified (in my terms), so you have just disconnected it
> from the original argument and connected it to [4,5,6]
>

Ok, thanks.
But there is a following question,when we say,

>>> x=[1,2,3]

we create a list.then we say,

>>> x=[4,5,6]

we create a new list and assign it to x for future use.
How to destroy the before list [1,2,3]? does python destroy it automatically?



More information about the Python-list mailing list