Skip to content

Instantly share code, notes, and snippets.

@gmbnomis
Last active November 11, 2019 23:21
Show Gist options
  • Save gmbnomis/944779d36e4c25a5700f4d7bd2750e3e to your computer and use it in GitHub Desktop.
Save gmbnomis/944779d36e4c25a5700f4d7bd2750e3e to your computer and use it in GitHub Desktop.
# First approach
class A:
vadifier = None
def create(self, ...):
...
if self.vadifier:
self.vadifier.run(new_version)
...
class B(A):
def __init__(self, vadifier_config):
self.vadifier = SpecialVadifier(vadifier_config)
class C(A):
def __init__(self, vadifier = None):
self.vadifier = vadifier
class D(A):
vadifier = NoCustomizationRequiredVadifier()
# Second approach
class A:
def create(self, ..., vadifier = None):
...
if vadifier:
vadifier.run(new_version)
...
class B(A):
def create(self, ..., vadifier = None):
...
vadifier = vadifier or MyOwnVadifier()
super(B).create(..., vadifier=vadifier)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment