GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Karteikarten

Ex 41

Bruno Miguel Cretu Learn Python the Hard Way Portugiesisch 16 Karten

Karten in diesem Stapel (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"

Informationen

Beschreibung
Learn Python the Hard Way Karteikarten am Ex 41, erstellt von Bruno Miguel Cretu am 29/10/2016.
Erstellt von
Bruno Miguel Cretu
Aufrufe
0
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck