GoConqr has a new look! Let us know what you think.

Flashcards

Ex 41

Bruno Miguel Cretu Learn Python the Hard Way Portuguese 16 cards

Cards in this deck (16)

  1. 1classTell Pyhton to make a new kind of thing
  2. 2objectThe most basic kind of thing
    Any instance of some thing
  3. 3instanceWhat you get when you tell Python to create a class
  4. 4defHow you define a function inside a class
  5. 5selfInside the functions in a class, self is a variable for the instance/object being accessed
  6. 6inheritanceThe concept that one class can inherit traits from another class
  7. 7compositionThe concept that a class can be composed of other classes as parts
  8. 8attributeA property classes have that are from composition and are usually variables
  9. 9is-aA phrase to say something inherits from another
  10. 10has-aA phrase to say something is composed of other things or has a trait
  11. 11class X (Y)"Make a class named X that is a Y"
  12. 12class X (object): def __init__(self, j)"Class X has-a __init__ that takes self and j as parameters"
  13. 13class X (object): def M (self, j)"Class X has-a function named M that takes self and j as parameters"
  14. 14foo = X ()"Set foo to an instance of class X"
  15. 15foo.M(j)"From foo get the M function, and call it with parameters self and j"
  16. 16foo.K = Q"From foo get K attribute, and set it to Q"

Information

Description
Learn Python the Hard Way Flashcards on Ex 41, created by Bruno Miguel Cretu on 29/10/2016.
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?