On Mar 18, 3:40 pm, "Dustan" <[EMAIL PROTECTED]> wrote:
> For example:
> aFunction(*(1,2,3))
> is equivalent to:
> aFunction(1,2,3)
>

That's the context I've seen it in, but written like this:

someFunc(*args)

I played around with it a little bit, and it appears the * operator
unpacks a list, tuple, or dictionary so that each element of the
container gets assigned to a different parameter variable.  Although
with a dictionary, only the keys appear to be assigned to the
parameter variables, e.g.:

def g(a,b,c):
        print a, b, c

dict = {"x":10, "y":20, "z":30}
g(*dict)

Is that right?



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to