I'd like to call something that takes 2 arguments:
def bar(arg1, arg2):
return arg1 + arg2
But in the call I'd like to only send one thing, a list:
baz = [1, 2]
foo = bar(baz)
So that wont work, but I am familiar with a concept in Tcl that would work in this situation and it would look like this:
proc bar {arg1 arg2} {
return arg1 + arg2
}
set baz [list 1 2]
set foo [bar {*}baz]
You'll notice the {*}. That thing, as far as I know, tells the Tcl interpreter to evaluate that and break the list apart first. so it sends in the two arguments not as one list, but as two arguments.
Does python have the same concept? I don't know what to call it, like an inline list separator or something.