Sign in New API Help About

243 bytes of Python
Created 17 hours ago — expires in 7 days
Viewed 58 times
https://dpaste.com/F8J8GYFBZ
COPY TO CLIPBOARD SOFT WRAP RAW TEXT DUPLICATE DIFF
# Understand Decorators in 30 seconds:

## Given:

def decorator(fn):
    fn.foo = true
    return fn

## Then 

def myfunc(...):
    ...

myfunc = decorator(myfunc)


## IS IDENTICAL TO

@decorator
def myfunc(...):
    ...

Share: