I want to inherit the collection arg from the Base class. How?
class Base(object):
def __init__(self, collection=None, classname=None):
self.__collection__ = collection or self.__class__.__name__
class Thing(Base):
def __init__(self, **kwargs):
super(Thing, self).__init__()
self.__dict__.update(kwargs)
t = Thing(collection='foobar')
t.__collection__
>>> 'Thing'
🙁
I don’t usually use
super(). I instead call the__init__function directly. Something like:Should yield what you want.