Answer the question
In order to leave comments, you need to log in
What is the RecursionError in the decorator function?
from math import factorial
from timeit import default_timer as timer
def how_much_time(func):
def wrapper_1(*args, **kwargs):
start = timer()
summator(*args, **kwargs)
finish = timer()
print(f"Time: {finish-start} in {func.__name__}")
return wrapper_1
@how_much_time
def summator(number):
print(f"Answer: {factorial(number)}")
summator(10)
Answer the question
In order to leave comments, you need to log in
wrapper_1 should call func and not summator:
you ended up replacing the adder with a wrapper around something that calls the adder, which in turn is a wrapper around the adder... and so on ad infinitum
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question