Last active
November 11, 2019 23:21
-
-
Save gmbnomis/944779d36e4c25a5700f4d7bd2750e3e to your computer and use it in GitHub Desktop.
This file contains 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
# 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