# Note that '*,' here is important. def foo(*, a=None): def bar(dictionary): dictionary['a'] = a return dictionary return bar print(foo(a=42)({ })) print(foo()({ }))