The methods seem to be __init__similar to this:
def __init__(self, ivar1, ivar2, ivar3):
self.ivar1 = ivar1
self.ivar2 = ivar2
self.ivar3 = ivar3
Is it possible to somehow include the arguments in the list (without resorting to *argsor **kwargs) and then use them setattrto set the instance variables with the parameter name and argument? And maybe slice the list, for example. you need to at least cut it on [1:], because you do not want to self.self.
(in fact, I assume that this should be a dictionary for storing name and value)
like this:
def __init__(self, ivar1, ivar2, ivar3, optional=False):
for k, v in makedict(self.__class__.__init__.__args__):
setattr(self, k, v)
Thanks!
Responding to an unknown answer, I found this to work:
Class A(object):
def __init__(self, length, width, x):
self.__dict__.update(dict([(k, v) for k, v in locals().iteritems() if k != 'self']))
or
Class A(object):
def __init__(self, length, width, x):
self.__dict__.update(locals())
del self.__dict__['self']
Not so bad..