0

I need to create a wrapper that can print something before the function runs. I have the following wrapper code so far:

def PrintBeforehand(func):
    def wrapper(*args, **kwargs):
        print(STUFF_TO_PRINT)
        func(*args, **kwargs)

If I just add another argument (STUFF_TO_PRINT) to PrintBeforehand, the function stops working as a wrapper entirely. How could I add an argument to the wrapper, with it still working as a wrapper?

Amogus
  • 11
  • 1

0 Answers0