nested scopes

Tim Peters tim.one at home.com
Sat Feb 3 01:30:12 EST 2001


[Robin Becker]
> ...
> As for the compiler statically determining what's in scope I
> thought the whole point of python was that it was dynamic and
> did late binding.

Na, the whole point of Python was to make Guido filthy rich.  It was
actually a bet between him and Bill Gates, and, despite what Microsoft may
tell you, the final outcome is still uncertain <ahem>.

WRT scopes, the determination of which names are local is entirely done at
compile-time.  That wasn't always true, but has been true since version
0.9.9, and was the single biggest speedup in Python's history.  The
determination of which names are local is still done at compile-time in the
presence of "import *" and "exec", but then the results can't be trusted,
and the compiler generates different code that does all sorts of crap under
the covers to give "the expected" results -- most of the time.  I doubt that
crap will get extended to live nice with deeply nested scopes, though.

> ...
> Optimality is the enemy of stability.

in-america-they-tell-us-it's-drugs<wink>-ly y'rs  - tim





More information about the Python-list mailing list