Learn Python the Hard Way – Exercise 41 Phrase Drills – Flashcards
Unlock all answers in this set
Unlock answersquestion
class X(Y)
answer
Make a class named X that is-a Y.
question
class X(object): def __init__(self, J)
answer
class X has-a __init__ that takes self and J parameters.
question
class X(object): def M(self, J)
answer
class X has-a function named M that takes self and J parameters.
question
foo = X()
answer
Set foo to an instance of class X.
question
foo.M(J)
answer
From foo get the M function, and call it with parameters self, J.
question
foo.K = Q
answer
From foo get the K attribute and set it to Q.