Shared Flashcard Set

Details

Exercise 41
Learning Python the Hard Way Exercise 41
16
Computer Science
Undergraduate 1
02/24/2014

Additional Computer Science Flashcards

 


 

Cards

Term
class X(Y)
Definition
"Make a class named X that is-a Y."
Term
class X(object): def __init__(self, J)
Definition
"class X has-a __init__ that takes self and J parameters."
Term
class X(object): def M(self, J)
Definition
"class X has-a function named M that takes self and J parameters."
Term
foo = X()
Definition
"Set foo to an instance of class X."
Term
foo.M(J)
Definition
"From foo get the M function, and call it with parameters self, J."
Term
foo.K = Q
Definition
"From foo get the K attribute and set it to Q."
Term
class
Definition
Tell Python to make a new kind of thing.
Term
object
Definition
Two meanings: the most basic kind of thing, and any instance of some thing.
Term
instance
Definition
What you get when you tell Python to create a class
Term
def
Definition
How you define a function inside a class.
Term
self
Definition
Inside the functions in a class, self is a variable for the instance/object being accessed.
Term
inheritance
Definition
The concept that one class can inherit traits from another class, much like you and your parents.
Term
composition
Definition
The concept that a class can be composed of other classes as parts, much like how a car has wheels
Term
attribute
Definition
A property classes have that are from composition and are usually variables.
Term
is-a
Definition
A phrase to say that something inherits from another, as in "salmon" is-a "fish."
Term
has-a
Definition
A phrase to say that something is composed of other things or has a trait, as in "a salmon has-a mouth."
Supporting users have an ad free experience!