[Python-Dev] LOAD_NAME & classes (original) (raw)

Greg Ewing greg@cosc.canterbury.ac.nz
Tue, 23 Apr 2002 12:57:15 +1200 (NZST)


Tim Peters <tim.one@comcast.net>:

Lexical scoping doesn't come naturally except to born Schemers, and indeed didn't come naturally to language designers either (e.g., early LISPs all had dynamic scoping).

I doubt whether the early designers of Lisp explicitly designed it to have dynamic scoping. Coming from lambda calculus, they were probably thinking of lexical scoping; it's just that the implementation they chose had some unfortunate side effects.

So, I conjecture that the idea of lexical scoping comes naturally enough, but a correct implementation of it doesn't. :-)

By the way, even in dynamically scoped Lisp, there's no equivalent of an UnboundLocalError -- to get a local variable at all, you have to bind some initial value to it. So, using Guido's terminology, early Lisp had dynamic scoping, but not dynamic lookup. Confused enough yet?-)

Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+