Lecture 8 2 Memory and Libraries
Lecture 8 2 Memory and Libraries
in Python
Sukrit Gupta
2 Libraries
The standard ‘core’ library
External libraries
def f(x):
y = 1
x = x + y
print ('x =', x) #
print ('y =', y) #
return x
x = 3
y = 2
z = f(x)
print ('z =', z)
print ('x =', x) #
print ('y =', y) #
def f(x):
def h():
z = x
print ('z =', z) #
def g():
x = 'abc'
print ('x =', x) #
x = x + 1
print ('x =', x) #
h()
g()
print ('x =', x) #
return x
x = 3
z = f(x)
print ('x =', x) #
print ('z =', z) #
Libraries
Library
A library is a collection of implementations of behavior, written in
terms of a language, that has a well-defined interface by which the
behavior is invoked.
2 Libraries
The standard ‘core’ library
External libraries