We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As presented, the trace_function
def trace_function(f): """Add tracing before and after a function""" def new_f(*args): """The decorated function.""" print('Called {}({!r})'.format(f, *args)) result = f(*args) print('Returning', result) return result return new_f if __name__ == '__main__': def add(a, b): return a + b traced_add = trace_function(add) traced_add(2, 3)
only prints the first argument:
Called <function add at 0x7fe633b77950>(2) Returning 5
By changing the first print line to look like:
print('Called {}{!r}'.format(f, args))
then it will print all of the arguments:
Called <function add at 0x7f509a9c7950>(2, 3) Returning 5
The text was updated successfully, but these errors were encountered:
No branches or pull requests
As presented, the trace_function
only prints the first argument:
By changing the first print line to look like:
then it will print all of the arguments:
The text was updated successfully, but these errors were encountered: