Home
Flashcards
Preview
Python Object Oriented Cards
Home
Get App
Take Quiz
Create
class
tell python to make a new kind of thing
object
two meanings: the most basic kind of thing, and any instance of some thing
instance
what you get when you tell python to create a class
def
how you define a function inside a class
self
inside the functions in a class, self is a variable for the instance/object being assessed
inheritance
the concept that one class can inherit traits from another class
composition
the concept that a class can be composed of other classes as parts
attribute
a property classes have that are from composition and are usually variables
is-a
a phrase to say that something inherits from another (salmon is-a fish)
has-a
a phrase to say that something is composed of other things or has a trait (salmon has-a mouth)
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, then call it with parameters self, J"
foo.K = Q
"from foo get the K attribute and set it to Q"
Author
kllewis
ID
202602
Card Set
Python Object Oriented Cards
Description
Python object oriented programming terms
Updated
2/22/2013, 7:45:51 PM
Show Answers
Home
Flashcards
Preview