Python Object Oriented Cards

The flashcards below were created by user kllewis on FreezingBlue Flashcards.

  1. class
    tell python to make a new kind of thing
  2. object
    two meanings: the most basic kind of thing, and any instance of some thing
  3. instance
    what you get when you tell python to create a class
  4. def
    how you define a function inside a class
  5. self
    inside the functions in a class, self is a variable for the instance/object being assessed
  6. inheritance
    the concept that one class can inherit traits from another class
  7. composition
    the concept that a class can be composed of other classes as parts
  8. attribute
    a property classes have that are from composition and are usually variables
  9. is-a
    a phrase to say that something inherits from another (salmon is-a fish)
  10. has-a
    a phrase to say that something is composed of other things or has a trait (salmon has-a mouth)
  11. class X(Y)
    "make a class named X that is-a Y"
  12. class X(object): def __init__(self, J)
    "class X has-a __init__ that takes self and J parameters"
  13. class X(object): def M(self, J)
    "class X has-a function named M that takes self and J parameters"
  14. foo = X()
    "set foo to an instance of class X"
  15. foo.M(J)
    "from foo get the M function, then call it with parameters self, J"
  16. foo.K = Q
    "from foo get the K attribute and set it to Q"
Card Set:
Python Object Oriented Cards
2013-02-22 19:45:51
python programming

Python object oriented programming terms
Show Answers: