Here's my solution via decorators:
def showargs(function):
def inner(*args, **kwargs):
return function((args, kwargs), *args, **kwargs)
return inner
@showargs
def some_func(info, arg1, arg2, arg3=1, arg4=2):
print arg1,arg2,arg3,arg4
return info
In [226]: some_func(1,2,3, arg4=4)
1 2 3 4
Out[226]: ((1, 2, 3), {'arg4': 4})
There may be a way to clean this up further, but this seems minimally intrusive to me and requires no change to the calling code.
Edit: To actually test if particular args were passed by keyword, then do something like the following inside of some_func:
args, kwargs = info
if 'arg4' in kwargs:
print "arg4 passed as keyword argument"
Disclaimer: you should probably consider whether or not you really care how the arguments were passed. This whole approach may be unnecessary.