lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 2 June 2011 08:39, Geoff Leyland <> wrote:
> Is "outer" new?

PEP 3104, 12th October 2006.

> I almost immediately got scope paranoia using Python, but that was a
> long time ago.

Since Python is local by default, I assume the above is to be
contrasted with the following:

> I hardly ever get tripped up by global by default if I do its easily fixed.

And hence you're saying neither is a big problem?

> Can you work around local by default without outer?

As Mike Pall points out on the wiki page, local-by-default without
outer or some other mechanism prevents access to variables in
non-global scopes lexically outside the current one. As the PEP says
of the situation before outer: "Currently, Python code can refer to a
name in any enclosing scope, but it can only rebind names in two
scopes: the local scope (by simple assignment) or the module-global
scope (using a global declaration)."