Module 8: Classes Flashcards
A class has ______ which are variables of the class and _______ which are functions to be called on instances of the class.
attributes
methods
The annotation of an attribute says _______ ________ ______
name
colon
type
Documentation for a class includes ________ and __________.
docstring
attribute annotations
______ methods start and end with two underscores, for the user to be able to use without defining them.
magic
__________ is used to give a more meaningful initialization of an object.
__init__
_________ and ________ are used to give a description of a printed object.
__repr__
__str__
_________ is used to redefine the comparison operator.
__eq__
a ________ is a function that is part of a class and will be called on an object.
method
All class methods must begin with _______ referential parameter which allows you to refer to the object that called this method.
self
Self is a value of _______ type as class being defined, so ______ the type annotation.
same
omit
While defining a class the class is not yet defined so _________ use the __________ inside the class definition. Instead, when referring to a value of the same class, use a ________ containing the name of the class.
cannot
name of the class
string
Instances of a class are _________.
objects
__init__ returns _________. ______ the annotation.
None
omit
Classes are ______ and can be _________ like dictionaries.
mutable
aliased
When using a class object, access the attributes and methods of the class by calling the __________ followed by _________ or __________.
object name
.attribute
.method(parameters)