About 23 results
Open links in new tab
  1. Python Design Patterns

    Python Design Patterns¶ Welcome! I’m Brandon Rhodes (website, Twitter) and this is my evolving guide to design patterns in the Python programming language. This site is letting me collect …

  2. The Composition Over Inheritance Principle - python-patterns.guide

    Let’s take a single design problem and watch how this principle works itself out through several of the classic Gang of Four design patterns. Each design pattern will assemble simple classes, …

  3. The Global Object Pattern - python-patterns.guide

    The Global Object Pattern¶ In the full-fledged Global Object pattern, as in the Constant pattern, a module instantiates an object at import time and assigns it a name in the module’s global …

  4. The Sentinel Object Pattern - python-patterns.guide

    The Sentinel Object pattern is a standard Pythonic approach that’s used both in the Standard Library and beyond. The pattern most often uses Python’s built-in None object, but in …

  5. The Iterator Pattern - python-patterns.guide

    How can a class implement the Iterator Pattern and plug in to Python’s native iteration mechanisms for, iter(), and next()? The container must offer an __iter__() method that returns …

  6. The Decorator Pattern - python-patterns.guide

    The design pattern became famous as the “Decorator Pattern” with the 1994 publication of the Gang of Four’s Design Patterns book. In 2003, the Python core developers decided to re-use …

  7. Gang of Four book - python-patterns.guide

    This site examines the old patterns from the Gang of Four in the context of a modern dynamic programming language in which classes and functions are first-class objects, to see which …

  8. The Singleton Pattern - python-patterns.guide

    Python programmers almost never implement the Singleton Pattern as described in the Gang of Four book, whose Singleton class forbids normal instantiation and instead offers a class …

  9. The Builder Pattern - python-patterns.guide

    The full-fledged Builder Pattern as imagined by the Gang of Four arranged for a single series of method calls to power the creation of several different object hierarchies — but that use of the …

  10. The Prebound Method Pattern - python-patterns.guide

    If the costs and benefits strike a similar balance for a module of your own you are designing, then the Prebound Method pattern can let you deliver remarkable convenience. The pattern¶ To …

Refresh