I have a base functionality
class Foo(object):
def method(self):
return True # or False based on custom logic for each class that will implement this class
def almost_common_method(self, params, force):
if self.method():
params.bleh = 'foo bar'
else:
params.bleh = 'not foo bar'
if force:
foobar = some_foo_bar(model_name = 'foo bar')
else:
default = Default()
def common_method(self, params, force):
return self.almost_common_method(params, force)
So, I am thinking of making a base class... where method raises NotImplementedError
I implement the common_method() in the base class as this will be shared across all the classes inheriting the base class?
But is there a way to define almost_common_method() in base class.. THe variable names are common.. but it is the string assignments which will differ.. across different implementations of this base class.?