1/26
Looks like no tags are added yet.
abstraction
when one class pretends to be another through operator overloading or familiar looking methods.
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.
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.
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
class
any type not built into python
class definition
class <classname>(<superclass>): oftentimes object is the super class
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.
default argument
value that is given to a parameter if the user does not provide that parameter
encapsulation
process of hiding parts of data and implementation from users. restricting access to attributes using getters and setters, and hidden methods
getter
special method that returns value of an instance attribute
global space
area of memory that stories any variable not defined in the body of a function
the heap
area of memory that stores mutable objects
immutable attribute
hidden attribute that has a getter but not setter
implementation
collection of python code that satisfies a specification
inheritance
process by which an object can have a method/attribute even if not explicitly mentioned in the class definition
interface
information that a user needs to know to use a python feature. displayed by the help() function
instance
object
invariant
a statement about an attribute that must always be true
is
works like == but compares folder names not contents
isinstance
returns True if object is an instance of class C or subclass of C
method
functions stored inside of a class folder
mutable attribute
hidden attribute that has a getter and a setter
object
value whose type is a class
operator overloading
means by which python evaluates operator symbols such as +,*,/, etc.
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
setter
special method that can change the value of an instance attribute and enforce invariants
subclass
class that extends another class