Decorator
def say_hello():
print("World")
say_hello()# Define a decorator function
def hello_decorator(func):
def wrapper():
print("Hello,")
func() # Call the original function
return wrapper
# Use the decorator to modify the behavior of say_hello
@hello_decorator
def say_hello():
print("World")
# Call the decorated function
say_hello()Multiple functions inside the Decorator
Args & Kwargs
Practice Item
Last updated