click below
click below
Normal Size Small Size show me how
Python OOP phrases
Phrases from Python OOP concepts
Question | Answer |
---|---|
class X(Y) | Make a class named X that is-a Y. |
class X(object): def __init__(self, J) | class X has-a __init__ that takes self and J parameters. |
class X(object): def M(self, J) | class X has-a function named M that takes self and J parameters. |
foo = X() | Set foo to an instance of class X. |
foo.M(J) | From foo get the M function, and call it with parameters self, J. |
foo.K = Q | From foo get the K attribute and set it to Q. |