Memory in Python - Cornell University
Lecture 10
Memory in Python
Announcements For This Lecture
Reading
? Reread all of Chapter 3
Assignments
? Some A1s still unfinished
? Finish these ASAP ? Ideally done by Monday
? A2 now posted
? Do not start until A1 done ? Due after Fall Break ? Uses material from Monday ? New topic: reading a file
9/29/17
Memory in Python
2
Modeling Storage in Python
? Global Space
Global Space
? What you "start with" ? Stores global variables ? Also modules & functions! ? Lasts until you quit Python
p
id2
Call Frame
incr_x
? Call Frame
? Variables in function call ? Deleted when call done
? Heap Space
? Where "folders" are stored ? Have to access indirectly
q
id2
id2 x 1.0
Heap Space
Point3
y 2.0 x 3.0
9/29/17
Memory in Python
3
Memory and the Python Tutor
Global Space
Heap Space
Call Frame
9/29/17
Memory in Python
4
Functions and Global Space
? A function definition...
? Creates a global variable (same name as function)
? Creates a folder for body ? Puts folder id in variable
def to_centigrade(x): return 5*(x-32)/9.0
Global Space
to_centigrade id6
Body
? Variable vs. Call
Heap Space
>>> to_centigrade >>> to_centigrade (32) 0.0
id6
function
Body
9/29/17
Memory in Python
5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- title clear — clear memory
- memory in python cornell university
- python activity 2 input and variables in python ioct
- what is a variable in python variable naming rules in python
- memory saving tips for circuitpython adafruit industries
- python v3 stack frame examples swarthmore college
- ppyytthhoonn vvaarriiaabbllee ttyyppeess
- python variable types picone press
- c4m the python memory model
- dude where s my ram a deep dive into how python uses memory
Related searches
- cornell university data analytics program
- cornell university data analytics certificate
- cornell university business analytics
- cornell university business
- cornell university johnson business school
- cornell university college of business
- cornell university college report
- cornell university reputation
- cornell university data analytics
- cornell university dyson business school
- cornell university johnson
- cornell university johnson school