Python Ch 9
The easiest way to save objects to permanent storage is to:
pickle them using the pickle function dump
Class B is a subclass of class A. The __init__ methods in both classes expect no arguments. The call of class A's __init__ method in class B is:
A.__init__(self)
A method contains:
A header and a body
Some standard operators can be overloaded for use with new classes of objects.
True
The try-except statement is used to catch and handle exceptions that might be raised in a set of statements.
True
A simple class consists of:
a header and a sets of method definitions
A class variable is used for data that:
all instances of a class have in common
A method definition
always must have at least one parameter name, called self
A polymorphic method:
has a single header but different bodies in different classes
The three most important features of object-oriented programming are
encapsulation, inheritance, and polymorphism.
In addition to methods a class includes:
instance variables
A data model:
is a set of classes that are responsible for managing the data of a program.
A view is
is a set of classes that are responsible for presenting information to a human user and handling user inputs.
An instance variable refers to the data value that :
is owned by a particular instance of a class and no other
Encapsulation:
restricts access to an object's data to users of the methods of its class.
The name used to refer to the current instance of a class within the class definition is:
self
The purpose of the __init__ method in a class definition is to
set the instance variable to initial values
encapsulation, inheritance, and polymorphism.
simplify programs and make them more maintainable
The scope of an instance variable is:
the entire class in which it is introduced
Pickling is:
the process of converting an object to a form that can be saved to permanent file storage.
A object's lifetime ends:
when it can no longer be referenced anywhere in a program