I have the following code:
def say_hello_then_call_f(f, *args, **kwargs): print 'args is', args print 'kwargs is', kwargs print("Hello! Now I'm going to call %s" % f) return f(*args, **kwargs) # when calling a function, however, * unpacks a tuple and ** unpacks a dict def g(x, y,s, z=1): return (x + y) / z I don't understand why the line below results in an error "non-keyword arg after keyword arg". Does it have to be that a functions has Keywords Arguments and only then Non-Keyword Arguments, even when passing values?:
say_hello_then_call_f(g, 1, y=2,4, z=5.) Thanks