You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the "log_function" wrapper I don't see the '3' printed as explained: my_function(1,2) # => "Entering function my_function" # => "3" # => "Exiting function my_function"
For the '3' to be printed I needed to add print(result) inside the log_function- I would suggest adding it.
The last line in the article didn't work for me- print(my_function.__code__.co_argcount) # => prints 0 instead of 2 as expected. I see in debugger that co_argcount inside the wrapper function=2, but it prints 0 for print(my_function.__code__.co_argcount).
Could it be that co_argcount is not supported in the functools @wraps?
The text was updated successfully, but these errors were encountered:
I saw 2 issues in the '7. Advanced' section:
my_function(1,2) # => "Entering function my_function"
# => "3"
# => "Exiting function my_function"
For the '3' to be printed I needed to add
print(result)
inside thelog_function
- I would suggest adding it.print(my_function.__code__.co_argcount) # =>
prints 0 instead of 2 as expected. I see in debugger thatco_argcount
inside the wrapper function=2, but it prints 0 forprint(my_function.__code__.co_argcount)
.Could it be that
co_argcount
is not supported in the functools @wraps?The text was updated successfully, but these errors were encountered: