Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



Tags
#python #sicp
Question
two key advantages of lexical scoping in Python.
Answer
  • Names for stuff in a local function don't affect names for stuff outside of that function (i.e you can have duplicate names without problems)
  • A local function can access stuff outside where it was defined because evaluation extends its environment

Tags
#python #sicp
Question
two key advantages of lexical scoping in Python.
Answer
?

Tags
#python #sicp
Question
two key advantages of lexical scoping in Python.
Answer
  • Names for stuff in a local function don't affect names for stuff outside of that function (i.e you can have duplicate names without problems)
  • A local function can access stuff outside where it was defined because evaluation extends its environment
If you want to change selection, open original toplevel document below and click on "Move attachment"

Parent (intermediate) annotation

Open it
two key advantages of lexical scoping in Python. The names of a local function do not interfere with names external to the function in which it is defined, because the local function name will be bound in the current local environme

Original toplevel document

1.6 Higher-Order Functions
name finds the first value bound to that name in the current environment. Python checks first in the sqrt_update frame -- no a exists. Python checks next in the parent frame, f1 , and finds a binding for a to 256. Hence, we realize <span>two key advantages of lexical scoping in Python. The names of a local function do not interfere with names external to the function in which it is defined, because the local function name will be bound in the current local environment in which it was defined, rather than the global environment. A local function can access the environment of the enclosing function, because the body of the local function is evaluated in an environment that extends the evaluation environment in which it was defined. The sqrt_update function carries with it some data: the value for a referenced in the environment in which it was defined. Because they "enclose" information in this way

Summary

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Details

No repetitions


Discussion

Do you want to join discussion? Click here to log in or create user.