The ** operator ambiguous?

Robert Dailey rcdailey at gmail.com
Mon Jul 16 13:40:14 EDT 2007


I noticed that the ** operator is used as the power operator, however
I've seen it used when passing variables into a function. For example,
I was researching a way to combine dictionaries. I found that if you
do this:

a = {"t1":"a", "t2":"b"}
b = {"t3":"c"}
dict( a, **b )


This combines the two dictionaries. However, I have no idea what the
** operator is here. I know that when you specify ** as a parameter in
a function definition, it represents a dictionary of parameters passed
in. However, in this example it is NOT being used in a function
definition. It is being used when passing variables into a function.
Can someone explain what this means? I looked in the documentation but
I couldn't find anything.




More information about the Python-list mailing list