Skip to content

Instantly share code, notes, and snippets.

@filinvadim
Last active November 9, 2017 15:17
Show Gist options
  • Save filinvadim/464ecafb828bcdf977576cb3ac32714b to your computer and use it in GitHub Desktop.
Save filinvadim/464ecafb828bcdf977576cb3ac32714b to your computer and use it in GitHub Desktop.
Python decorators simple explanation
def decor(func):
def wrapped(a, b):
a = 'deco'
b = 'rated'
return func(a, b)
return wrapped # not calling yet
@decor # init decor here
def funkcia(a, b):
return a + b
a = 1
b = 2
print(funkcia(a, b))
# 'decorated'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment