We require two extensions to our environment model to enable lexical scoping.
Each user-defined function has a parent environment: the environment in
which it was defined.
When a user-defined function is called, its local frame extends its parent
environment.
If you want to change selection, open document below and click on "Move attachment"
1.6 Higher-Order Functions
enclosing function sqrt . This discipline of sharing names among nested
definitions is called lexical scoping. Critically, the inner functions have
access to the names in the environment where they are defined (not where they
are called).
<span>We require two extensions to our environment model to enable lexical scoping.
Each user-defined function has a parent environment: the environment in
which it was defined. When a user-defined function is called, its local frame extends its parent
environment.
Previous to sqrt , all functions were defined in the global environment,
and so they all had the same parent: the global environment. By contrast, when
Python evaluates the first tw
Summary
status
not read
reprioritisations
last reprioritisation on
suggested re-reading day
started reading on
finished reading on
Details
Discussion
Do you want to join discussion? Click here to log in or create user.