expanding a list and dict to a *args and **dict
Dan Parisien
dan at eevolved.com
Fri Feb 2 12:15:57 EST 2001
Is it possible to 'expand' a list or dictionary into its components to call
a function expecting many parameters?
I want to be able to call a function without accessing each individual
element manually (list[0], list[1], list[2])
I'm sending random parameters over a network (*args and **dict). When I
unpickle them on the other side, I get a python list and dictionary. I then
call an arbitrary function (actually a reference to a function that was
bound at runtime a la
self.randomfunction = obj.specificfunction
)
That function is not expecting a list and a dictionary, instead it is
expecting specific parameters(that i don't know at runtime) and I want to
take the list and turn it into a bunch of parameters like list[0], list[1],
list[2] (but as stated above, I can't do that)
Ha. I hope someone understood me :)
Dan
More information about the Python-list
mailing list