list of functions
logistix
logstx at bellatlantic.net
Sat Mar 30 18:00:17 EST 2002
Is this what you want?
x = (1,2,3) #create a tuple
apply(list_of_functions[0], x) #apply args to function
#or
list_of_functions[0](*x)
--
-
"John" <nobody at nobody.com> wrote in message
news:01rp8.34168$tg4.401910 at vixen.cso.uiuc.edu...
>
> Hi,
>
> I was glad to find that Python allows the following:
>
> def addone(a): return a+1
> list_of_functions=[addone]
> list_of_functions[0](1) --> returns 2
>
> However, what if the functions require more than one arguments? say
> def addall(a,b,c): return a+b+c?
> Though list_of_functions[0](1,2,3) works, I'd like to make (1,2,3) as
> variables.. How do I pass the variables to such functions?
>
>
More information about the Python-list
mailing list