This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def swipeleft(somelist): | |
| for something in somelist: | |
| yield something | |
| people = [1,2,3,4,5,6,7,8] | |
| swipelefter = swipeleft(people) | |
| for person in swipelefter: | |
| print(person) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | """ | |
| This design pattern permits access to the elements of an aggregate | |
| in a clear handler without exposing underlying representations. | |
| """ | |
| import collections.abc | |
| class ConcreteAggregate(collections.abc.Iterable): | |
| """ | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class PAGovernor(object): | |
| class __OnlyOne: | |
| def __init__(self): | |
| print("the governor is ",repr(self)) | |
| self.policy = None | |
| def __str__(self): | |
| return repr(self) + self.policy | |
| instance = None | |
| def __new__(cls): # __new__ always a classmethod | |
| if not PAGovernor.instance: | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # Proxy.py | |
| # Simple demonstration of the Proxy pattern. | |
| class Implementation2: | |
| lock = True | |
| hog = 0 | |
| def nextData(self, maskedPassword): | |
| maskedExpectedPass = '12345' | |
| if maskedPassword==maskedExpectedPass: | |
| return "I just got data using the password" | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import random | |
| """ | |
| I am using mediator to represent a simplified board game version of the Game of Life | |
| This LifeCellGridMediator defines an object that encapsulates how a set of mediated objects interact. | |
| "Mediator promotes loose coupling by keeping objects from referring to | |
| each other explicitly, and it lets you vary their interaction independently." | |
| """ | |
| class LifeCellGridMediator: | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import pickle | |
| class Originator: | |
| """ | |
| Use the memento pattern to create a memento | |
| containing a snapshot of the video game's current internal | |
| state. | |
| Use the memento to restore its internal state. | |
| """ | |
| def __init__(self): | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | from functools import wraps | |
| def guarantee(*argsx): | |
| """"this is a decorator to guarantee specific keyword arguments are used | |
| in an otherwise open ended keyword argument list | |
| Allows for extra messaging and handling for an error related to missing or invalid keyword arguments | |
| """ | |
| def real_decorator(func): | |
| @wraps(func) | |
| def wrapper(*args, **kwargs): | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class McPattyBurgers: | |
| def __init__(self): | |
| self._apps = Apps('Quesadillas') | |
| self._frozenpatty = FrozenPatty() | |
| self._prepackagedbun = PrepackagedBun() | |
| def homemadeburger(self): | |
| self._apps.microwave() | |
| self._frozenpatty.zap() | |
| self._frozenpatty.slatherwith('ketchup') | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    | Type | Design Pattern Name | Description | |
|---|---|---|---|
| Creational | Abstract Factory | This abstraction represents a cluster of dependent or related objects without specifying exact classes | |
| Creational | Builder | Decouples construction of a complex object from its representation and allows similar complex objects to be built from the same design. | |
| Creational | Factory Method | This class is able to be a factory to create many different subclasses with the same interface | |
| Creational | Prototype | You create one instance of the class: then no more new() instances-- just copies of the one instance you made | |
| Creational | Singleton | This is a class which insures one and only one instantiation of itself will be available at a time | |
| Structural | Adapter | This adapter pattern allows one class to speak with a client which requests a different interface | |
| Structural | Bridge | Loosely couple the abstract class through an implementor to the possibly considerably more different concrete classes | |
| Structural | Composite | The composite design pattern consists of nested classes | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    | type | meeting checklist item | result | |
|---|---|---|---|
| pre-meeting | How far in advance did you schedule it? | ||
| pre-meeting | Does the meeting have a clear topic and agenda? |