nested scopes

Michael Hudson mwh21 at cam.ac.uk
Tue Feb 6 16:59:03 EST 2001


"Rainer Deyke" <root at rainerdeyke.com> writes:

> "Michael Hudson" <mwh21 at cam.ac.uk> wrote in message
> news:m3lmrj35z6.fsf at atrus.jesus.cam.ac.uk...
> > "Rainer Deyke" <root at rainerdeyke.com> writes:
> > > Some Python functions (including 'globals' and 'locals') have behavior
> > > similar to that of dynamic scoping.
> >
> > How so?  Note I'm using "dynamic scope" in a pretty technical sense
> > here - "indefinite scope and dynamic extent".  Python variables have
> > definite scope and dynamic extent (although the objects they point to
> > have indefinite extent).
> 
> I am referring to the fact that these functions access the namespace of the
> calling function.

Oh, I see (I think).  I wouldn't have said that was an instructive
example myself.

Cheers,
M.

-- 
  All parts should go together without forcing. You must remember that
  the parts you are  reassembling were disassembled by you.  Therefore,
  if you can't get them together again, there must be a reason. By all
  means, do not use a hammer.          -- IBM maintenance manual, 1925



More information about the Python-list mailing list