Answers for "decorator"

1

decorator

def my_decorator(func):
    def wrapper():
        print("Something is happening before the function is called.")
        func()
        print("Something is happening after the function is called.")
    return wrapper

@my_decorator
def say_whee():
    print("Whee!")
Posted by: Guest on June-09-2021

Browse Popular Code Answers by Language