Skip to content

Instantly share code, notes, and snippets.

@PiDelport
Last active October 10, 2015 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PiDelport/3756230 to your computer and use it in GitHub Desktop.
Save PiDelport/3756230 to your computer and use it in GitHub Desktop.
Format a function call as a string.
import inspect
def format_call(func, *positional, **named):
_locals = inspect.getcallargs(func, *positional, **named)
spec = inspect.getargspec(func)
argvalues = inspect.formatargvalues(spec.args, spec.varargs, spec.keywords, _locals)
return '{}{}'.format(func.__name__, argvalues)
@PiDelport
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment