This is not the result I expect to see:
class A(dict):
def __init__(self, *args, **kwargs):
self['args'] = args
self['kwargs'] = kwargs
class B(A):
def __init__(self, *args, **kwargs):
super(B, self).__init__(args, kwargs)
print 'Instance A:', A('monkey', banana=True)
#Instance A: {'args': ('monkey',), 'kwargs': {'banana': True}}
print 'Instance B:', B('monkey', banana=True)
#Instance B: {'args': (('monkey',), {'banana': True}), 'kwargs': {}}
I'm just trying to get classes A and B to have consistent values set. I'm not sure why the kwargs are being inserted into the args, but I'm to presume I am either calling __init__()
wrong from the subclass or I'm trying to do something that you just can't do.
Any tips?