from displays.PlayerDisplay import PlayerDisplay from displays.SpecialDisplay import SpecialDisplay class DisplayFactory: def __init__(self, displayNames): self.displayNames = displayNames def createSpecialDisplay(self): name = next(displayName for displayName in self.displayNames if "Special" in displayName) return SpecialDisplay(name) def createPlayerDisplay(self, id): name = next(displayName for displayName in self.displayNames if "Player" in displayName and str(id) in displayName) return PlayerDisplay(name)