Stargaming <[EMAIL PROTECTED]> wrote:
>
>Even though you have the assignment operator *in both cases*, it does
>**not** issue the same thing.
>
>As Bruno pointed out, in the first case ``y = [3,4]`` it is *rebinding*
>the name `y`.
There have been two good replies to this, but I would like to p
On Thu, 13 Dec 2007 22:52:56 +0100, Bruno Desthuilliers wrote:
> flyfree a écrit :
[snip]
>> What is the difference between "y = [3,4]" and "y[0]=3 y[1] =4 "
>
> In the first case, you rebind the local name y to a new list object -
> and since the name is local, rebinding it only affects the loca
flyfree a écrit :
def fooA(y):
>
> y = [3,4]
> return y
>
>
def fooB(y):
>
> y[0] = 3
> y[1] = 4
> return y
>
>
x = [1,2]
fooA(x)
>
> [3, 4]
>
x
>
> [1, 2]
>
>
fooB(x)
>
> [3, 4]
>
x
>
> [3, 4]
> ===
>
> From above