Lecture 9: Memory in Python
CS 1110 Introduction to Computing Using Python
[E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C. Van Loan, W. White]
Lecture 9: Memory in Python CS 1110 Introduction to Computing - - PowerPoint PPT Presentation
http://www.cs.cornell.edu/courses/cs1110/2019sp Lecture 9: Memory in Python CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C. Van Loan, W. White] Global Space Global Space Global
[E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C. Van Loan, W. White]
1
adjust_x_coord
1
1
adjust_x_coord
1
None
id2
7
Where does the line start? x: 1 y: 2 The line starts at (1,2). Where does the line stop? x: 4 y: 6 The line stops at (4,6).
8
9
10
11
12
13
1 2 3 4 5
configure 3 4 id1
pt 6
“start”
role
14
1 2 3 4 5
configure 3 4 id1
pt 6
“start”
role
15
get_coord “x”
name
1 configure id1
pt
“start”
role 1 2 3 4 5 6
3 4
16
get_coord “x”
name
1 2
configure id1
pt
“start”
role 1 2 3 4 5 6
“1”
x
1
RETURN
3 4
17
get_coord “x”
name
1 2
configure 3 4 5 id1
pt
“start”
role 1 2 3 4 5 6 x
1
RETURN
“1”
18
function1
function2 function3 function4 function5
19
f1 f2 f3
f3 f3 f1 f2 f3
f3 f1 f2 f3
f1 f2
f1
20
f1 f2 f3
f3 f3 f1 f2 f3
f3 f1 f2 f3
f1 f2
f1
21
1 2 3 4 5 6
Where does the line start? x: 1 Traceback (most recent call last): File "v3.py", line 15, in <module> configure(start, "start") File "v3.py", line 9, in configure pt.x = get_coord("x") File "v3.py", line 5, in get_coord return str(x1) NameError: name 'x1' is not defined
22
module
pi 3.141592 e 2.718281 functions
23
math pi 3.141592 e 2.718281 functions
id2