Python varargs before function name?
I am doing Python coding in a client code base and I came across a line of code that looks something like this (variable names have been changed to protect the innocent):
reply = function1(a=foo, **function2(bar, b=baz))
Usually ** in the argument list collects the remaining keyword arguments, but what do they do before the function name?
+2
JΓΆrgen Lundberg
source
to share
1 answer
I would say that this is just a function call that returns a dict-like object, and so the asterisks will just convert the returned dict to keyword arguments for function1 as usual.
+11
Horst gutmann
source
to share