Exam in lab, Thursday, March 5th
(Section 3.3)
The textual region of a program where a binding is active
Can also be used to refer to a region of a program where no bindings are changing
The set of active bindings
import inspect
def main():
a = 1
def sub(b):
c = 3
print('Locals:', inspect.currentframe().f_locals)
print('Parent:', inspect.currentframe().f_back.f_locals)
sub(2)
main()Locals: {'c': 3, 'b': 2}
Parent: {'sub': <function main.<locals>.sub at 0x7f89903ce268>, 'a': 1}
Binding can be determined at compile time
10 FOR X = 1 TO 10
20 PRINT "HELLO, WORLD"
30 NEXT X
integer if name begins with I-N or real
otherwise)save in Fortran, own in AlgolSection 3.5
Some names can refer to multiple objects at a given time
Allows a subroutine to perform differently based on the types involved
Section 3.6