[BangPypers] Enclosing lexical context

Picachu Nioto picachu.nioto at gmail.com
Thu Apr 15 19:46:18 CEST 2010


Thanks for the prompt response Noufal!

Could you explain, in what context is it mentioned here?
http://pastebin.com/zLnL7yy8

<http://pastebin.com/zLnL7yy8>

On Thu, Apr 15, 2010 at 11:09 PM, Noufal Ibrahim <noufal at gmail.com> wrote:

> On Thu, Apr 15, 2010 at 10:36 PM, Picachu Nioto <picachu.nioto at 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 at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list