On Tue, Jan 13, 2015 at 7:51 AM, <stephen.bou...@gmail.com> wrote:

> I'm a bit confused why in the second case x is not [1,2,3]:
>
> x = []
>
> def y():
>     x.append(1)
>
> def z():
>     x = [1,2,3]
>
> y()
> print(x)
> z()
> print(x)
>
> Output:
> [1]
> [1]
>

x in the outer scope is not x in the z() scope

> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to