bookmate game
en

Packt Publishing

  • DDaudalagidcompartió una citahace 2 años
    Each Python class definition has an implicit superclass: object.
  • DDaudalagidcompartió una citahace 2 años
    When we define our own class, object is the superclass.
  • DDaudalagidcompartió una citahace 2 años
    The superclass of all classes, object, has a default implementation of __init__() that amounts to pass. We aren't required to implement __init__(). If we don't implement it, then no instance variables will be created when the object is created.
  • DDaudalagidcompartió una citahace 2 años
    Refactoring is better than adding if statements.
  • DDaudalagidcompartió una citahace 2 años
    "Explicit is better than implicit."
  • DDaudalagidcompartió una citahace 2 años
    In this example, we factored the __init__() method into the superclass so that a common initialization in the superclass, Card, applies to all the three subclasses NumberCard, AceCard, and FaceCard.
  • DDaudalagidcompartió una citahace 2 años
    A small domain of static objects may be part of implementing a Strategy or State design pattern.
    In some cases, we may have a pool of constant objects created in an initialization or configuration file, or we might create constant objects based on command-line parameters.
  • DDaudalagidcompartió una citahace 2 años
    This can make the Strategy or State design patterns work efficiently by reusing objects from a small, static pool of constants.
  • DDaudalagidcompartió una citahace 2 años
    We define a function that creates objects of the required classes.
    We define a class that has methods for creating objects. This is the full factory design pattern, as described in books on design patterns. In languages such as Java, a factory class hierarchy is required because the language doesn't support standalone functions.
  • DDaudalagidcompartió una citahace 2 años
    The advantage of class definitions in general is to achieve code reuse via inheritance.
fb2epub
Arrastra y suelta tus archivos (no más de 5 por vez)