Skip to content

Instantly share code, notes, and snippets.

@dmi3coder
Created November 28, 2019 12:13
Show Gist options
  • Save dmi3coder/83fb31d23ce14cf43a9fd224a85d79a8 to your computer and use it in GitHub Desktop.
Save dmi3coder/83fb31d23ce14cf43a9fd224a85d79a8 to your computer and use it in GitHub Desktop.
Example of decorator without @ sign
def as_html(func):
def wrapper():
result = func()
return f'<html>{result}</html>'
return wrapper
def say_hello():
return 'Hello'
print(as_html(say_hello)())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment