Skip to content

Instantly share code, notes, and snippets.

@ricardodani
Created May 11, 2022 01:56
Show Gist options
  • Save ricardodani/3e724df363071b6a05e94c54fc03b099 to your computer and use it in GitHub Desktop.
Save ricardodani/3e724df363071b6a05e94c54fc03b099 to your computer and use it in GitHub Desktop.
Python decorator
def print_result(func):
def decorated_func(a, b):
return f"o resultado é {func(a, b)}"
return decorated_func
@print_result
def soma(a, b):
return a + b
@print_result
def multiplica(a, b):
return a * b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment