¡GoConqr estrena diseño! Cuéntanos qué te parece.

Fichas

Ex 41

Bruno Miguel Cretu Learn Python the Hard Way Portugués 16 fichas

Fichas del conjunto (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"

Información

Descripción
Learn Python the Hard Way Fichas sobre Ex 41, creado por Bruno Miguel Cretu el 29/10/2016.
Visitas
0
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?