On Thu, Apr 15, 2010 at 10:36 PM, Picachu Nioto <picachu.ni...@gmail.com>wrote:
> Could some one explain to me this sentence, I read in an example online > > "Python doesn't implement assignment of variables bound in an enclosing > lexical context" > >>> a=[10] >>> def f(x): ... a[0]=x ... print a ... >>> f(2) [2] >>> print a [2] In this case, the outer a is accessed automatically since we are using indices and there is no local list "a", Python finds the scope from the global scope and assigns correctly. > Example, > a=[b] > > Looking at your code above, perhaps the 2nd explanation makes it clear. > --Picachu > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- --Anand _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers