On Sun, Nov 9, 2014 at 1:14 AM, Noufal Ibrahim KV <nou...@nibrahim.net.in> wrote:
> How is lexical scoping with a mutable environment different from dynamic > scoping? > I think you should post this in python-dev and you might get answers with rigorous definitions. Here is my short snippet which shows a behavior which does not indicate a dynamic binding nature. # example.py x = 10 y = lambda: x def f(): x = 20 # This is not rebinding. It is creating a new local variable by name x # But we are referring to x in y function call, so for the definition of dynamic binding (?) # should y() see x defined in the local scope instead of the previously assigned value. print(y()) return y() x = 30 # This is rebinding in the same scope. print(f()) $ python example.py 30 30 _______________________________________________ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers