
July 21, 2016
10:48 a.m.
From: Nick Coghlan Sent: Thursday, July 21, 2016 11:21 AM
On 22 July 2016 at 00:19, Emanuel Barry <vgr255@live.ca> wrote:
Hello,
You’re presumably doing something like ‘star = starcaller(f); star((“foo”, “bar”, “baz”))’ – how is it different from ‘f(*(“foo”, “bar”, “baz”))’ ? I don’t see any difference…
Similar to functools.partial, it lets you more easily separate the process of changing a function's signature from actually calling it.
Compare:
def f(a, b): print(a, b)
accepts_only_b = functools.partial(f, "predefined_a") accepts_args_as_tuple = operator.starcaller(f)
Ah, of course - I didn't think of the multiple arguments case, thanks :) -Emanuel