Converting a tuple to an argument list for a method?
sholden at holdenweb.com
Thu Oct 18 14:40:15 CEST 2001
"Gabriel Ambuehl" <gabriel_ambuehl at buz.ch> wrote in message
news:mailman.1003398391.16015.python-list at python.org...
> -----BEGIN PGP SIGNED MESSAGE-----
> I'm messing with the XMLRPC implementation from PythonWare which
> makes the arguments to the request available as tuple but the
> I want to call expect a normal argument list as their parameters.
> So xmlprc delivers:
> xmlrpcparam=(param1, param2, param....)
> which won't work for
> method(param1, param2, param3)
> because the tuple only counts as one argument. So is there a
> possibility to use the tuple (which hasn't got a fixed length cause
> different methods on the server need different numbers of arguments,
> else it would be easy to just do
> method(xmlrpcparam, xmlrpcmethod)) to form an argument list for
> the methods on the server?
> Currently less important: is there a way to use named arguments with
> xmlrpc so that the server could decide whether the format of the
> clients request is valid?
> Any comments would be greatly appreciated.
Without testing, it looks like
ought to work for you. Each element of the tuple becomes a positional
>>> def one(a,b,*rest):
... print "a:", a, "b:", b, "rest:", rest
a: A b: B rest: ('C', 'D')
More information about the Python-list