Prelim 1 Flashcards
Argument
An argument is an expression that appears within the parentheses of a function call.
Assert statement
<assert> <boolean-expression>. If the boolean expression is true, the statement does nothing. If it is false, the expression produces an error and the program stops running.
</boolean-expression></assert>
Assignment statement
<variable> = <expression>. If the variable on the left hand side does not exist yet, it is created and stores the value of the expression inside. If the variable does exist, it replaces the old value stored inside the variable with the value of the expression.
</expression></variable>
Attribute
A variable that is stored inside an object. Attributes typically have invariants, rules specifying how they can be modified.
Call Frame
A formal representation of what Python uses when you execute a function call. It contains the name of the function, parameters, local variables and a counter.
Call Stack
All of the call frames of the currently executing function call
Class
Any type that is not built-in to python
Constructor
A function that creates a mutable object. It puts the object in heap space and returns the name of the object so you can store it in a variable.
Expression
Python code that produces a value. They must be put inside a statement.
Function
A parameterized sequence of statements that perform a task.
Fruitful Function
A function that returns a value.
Function Call
Expression that executes a function body
Function Header
The first line of a function definition. It includes the keyword def, name of function, parameters within parentheses (if appropriate), and a colon.
Global Space
Area of memory that stores variables defined outside the body of a function.
Heap Space
Area of memory that stores mutable objects.
Literal
An expression that, when evaluated, evaluates to itself. An expression that is also a value
Method
A function that is stored inside of an object
Object
A (mutable) object is a value whose type is a class. Objects typically contain attributes and have methods.
Procedure
A function that does not return a value
Scope
The set of places in which a variable can be referenced
Specification
A description of what a function should do. Includes preconditions on arguments and return value of function if it is a fruitful function.
Statement
A command for Python to do something. There are 5 types: try-except, assert, assignment, conditional, and return.
Type
A set of values and the operations on them.
Variable
A named box containing a value.