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"
>
> Example,
> a=[b]

I'm not sure where you got this sentence means but Python's scoping is
lexical but has 2 namespaces accessible from the current point of
execution (locals and globals) which are arguably dynamic. Here's an
example to show lexical scoping.

http://pastebin.com/k2S5pvjZ

You can see that it prints 1 which is the value of the free identifier
foo lexically at the point of the print.

As a counter example, here's an example in Emacs lisp which parallels
the above but since it's dynamically scoped, the value printed is 2.
http://pastebin.com/KX0JwC0u



-- 
~noufal
http://nibrahim.net.in
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to