function arguments

Paul Rubin http
Wed Sep 15 18:09:14 EDT 2004


"Joe Laughlin" <Joseph.V.Laughlin at boeing.com> writes:
> def foo(list_of_args):
>     call_other_function(arg1, arg2, arg3)
>     # Where arg1 == "x", arg2 == "y", etc.
>     # Should work with any list size
> 
> foo(["x", "y", "z"])
> 
> Make sense?  Need clarification?  

In the old days you'd have had to say

   apply(call_other_function, list_of_args)

But now you can just say

   call_other_function(*list_of_args)

which does the same thing.  The asterisk turns your list into an arglist.



More information about the Python-list mailing list