On Fri, 30 Jun 2006, Andrew Koenig wrote:
> The fundamental principle is that the binding of every name is determined
> during compilation, not during execution.  This property does not quite
> apply to Python at present.

I think this property does apply.  In your example:

>       def g():
>               return x
>       x = 42
>       g()
>
> the result is 42.

It is already known at compile time that the "return x" in g()
refers to an 'x' in the outer scope.  'x' cannot be a local variable
to g() because there are no statements in g() that bind 'x'.

Regardless of whether the binding itself exists yet, you (the reader)
and the compiler can know which scope to look in for the binding at
runtime.  Have i understood your desired property correctly?


-- ?!ng
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to