cs prelim 2

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

1/26

encourage image

There's no tags or description

Looks like no tags are added yet.

27 Terms

1
New cards

abstraction

when one class pretends to be another through operator overloading or familiar looking methods.

2
New cards

accumulator

variable in a for-loop that stores information computed in the for-loop and which will still be available when the for-loop is complete.

3
New cards

attribute

variables stored inside of an object. instance attributes belong to an instance and are typically created in the class initializer. class attribute belong to the class and are typically created in an assignment statement that prefaces the class.

4
New cards

bottom-up rule

python first looks in the object folder, and then moves up to the class folder/parent class/superest object class to find it

5
New cards

class

any type not built into python

6
New cards

class definition

class <classname>(<superclass>): oftentimes object is the super class

7
New cards

constructor

function that creates an object for a class. it puts the object in heap space and has the same name as the type of object. it creates an empty folder in the heap, executes the __init__ (passes the folder name to parameter self, passes arguments, executes commands), and returns the object name as a final value of expression.

8
New cards

default argument

value that is given to a parameter if the user does not provide that parameter

9
New cards

encapsulation

process of hiding parts of data and implementation from users. restricting access to attributes using getters and setters, and hidden methods

10
New cards

getter

special method that returns value of an instance attribute

11
New cards

global space

area of memory that stories any variable not defined in the body of a function

12
New cards

the heap

area of memory that stores mutable objects

13
New cards

immutable attribute

hidden attribute that has a getter but not setter

14
New cards

implementation

collection of python code that satisfies a specification

15
New cards

inheritance

process by which an object can have a method/attribute even if not explicitly mentioned in the class definition

16
New cards

interface

information that a user needs to know to use a python feature. displayed by the help() function

17
New cards

instance

object

18
New cards

invariant

a statement about an attribute that must always be true

19
New cards

is

works like == but compares folder names not contents

20
New cards

isinstance

returns True if object is an instance of class C or subclass of C

21
New cards

method

functions stored inside of a class folder

22
New cards

mutable attribute

hidden attribute that has a getter and a setter

23
New cards

object

value whose type is a class

24
New cards

operator overloading

means by which python evaluates operator symbols such as +,*,/, etc.

25
New cards

overriding a method

can redefine a method that was defined in a superclass. to call an overridden method use super().method(…) or super(self,<childclass>).method(…) where <childclass> is the immediate child of the class you want to access

26
New cards

setter

special method that can change the value of an instance attribute and enforce invariants

27
New cards

subclass

class that extends another class