G
Greg Hoover
I'd like to create objects on the fly from a pointer to the class
using: instance = klass() But I need to be able to pass in variables
to the __init__ method. I can recover the arguments using the
inspect.argspec, but how do I call __init__ with a list of arguments
and have them unpacked to the argument list rather than passed as a
single object?
ie. class T:
def __init__(self, foo, bar):
self.foo = foo
self.bar = bar
argspec = inspect.argspec(T.__init__)
args = (1, 2)
??? how do you call T(args)?
Thanks.
Greg
using: instance = klass() But I need to be able to pass in variables
to the __init__ method. I can recover the arguments using the
inspect.argspec, but how do I call __init__ with a list of arguments
and have them unpacked to the argument list rather than passed as a
single object?
ie. class T:
def __init__(self, foo, bar):
self.foo = foo
self.bar = bar
argspec = inspect.argspec(T.__init__)
args = (1, 2)
??? how do you call T(args)?
Thanks.
Greg