Question: python Use decorator function you created for the previous homework and estimate how much operation on a dictionary is faster(or slower) than operation on a
python
Use decorator function you created for the previous homework and estimate how much operation on a dictionary is faster(or slower) than operation on a shelve
import time
def simple(): # simple function print("I am simple function")
def decorate_it(func): # decorator function def newfunction(): # creating the new function print("This is the new line added to your simple function:") simple()
return newfunction # returning the new function
start = time.time() new_function = decorate_it(simple) new_function() # calling the new function end = time.time() print(end - start)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
