cs1110 prelim 2 terminology

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/27

encourage image

There's no tags or description

Looks like no tags are added yet.

28 Terms

1
New cards
abstraction
one class acting like another through operator overloading or familiar methods
2
New cards
accumulator
loop variable that stores results and is still available after the loop
3
New cards
attribute
variable stored inside an object (instance attribute) or class (class attribute)
4
New cards
bottom-up rule
Python looks for an attribute or method in the object folder, then its class, then each parent up to object
5
New cards
class
a type not built into Python, its values are objects
6
New cards
class definition
blueprint listing the attributes and methods every object of the class has
7
New cards
constructor
function with the class's name that creates a folder in the heap, runs __init__, and returns the folder id
8
New cards
default argument
value a parameter gets if the caller leaves it out, all later parameters need defaults too (ex: def foo(x, y=2, z=3))
9
New cards
encapsulation
hiding data and implementation (hidden attributes, getters, setters, hidden methods) from users that don't need access to that part of your code
10
New cards
getter
method returning a hidden attribute's value without allowing changes
11
New cards
global space
memory for variables defined outside any function, lasts until erased or Python quits
12
New cards
heap
memory for object folders, class folders, function definitions, and modules, only can be reached through ids stored in variables
13
New cards
immutable attribute
hidden attribute with a getter but no setter (_name)
14
New cards
implementation
code that satisfies a specification
15
New cards
inheritance
an object having a method or attribute because its superclass defines it
16
New cards
interface
what a user needs to know to use something (specification, header, help())
17
New cards
instance
synonym for object
18
New cards
invariant
statement about an attribute that must always be true
19
New cards
is
compares folder ids, not contents (a is b)
20
New cards
isinstance(ob, C)
True if ob is an instance of C or any subclass of C
21
New cards
method
function stored in class folder, can call it by saying objectVariable.method()
22
New cards
mutable attribute
hidden attribute with getter and setter
23
New cards
object
value whose type is a class
24
New cards
operator overloading
Python uses left class/type special method (like __add__) to evaluate an operator
25
New cards
overriding
subclass redefines a parent method, super().method() calls parent version
26
New cards
setter
method that changes a hidden attribute after asserting its invariant
27
New cards
subclass
class that extends another, inheriting all its attributes and methods
28
New cards
tuple
immutable sequence written with parentheses, you index and slice it like a list, but you can't change its items. ex: t = ([4],[3]), t[0] is [4]