In Python I have a dictionary of settings which relate to a task class. In the parent constructor of these tasks I would like to store only the relevant settings, but to do this I need to access the child class from the parent class.
settings = {
SomeTask: { 'foo': 'bar' },
SomeOtherTask: { 'bar': 'foo' },
}
class SomeTask(BaseTask):
pass
class SomeOtherTask(BaseTask):
pass
class BaseTask:
def __init__(self, settings):
self.settings = settings[child_class]
In PHP I can do this by calling get_class($this); in the constructor (returns the child class name rather than the parent), does Python have something similar?