Editing because the initial code was confusing.
I would assume these two things to be same,
#I would use either of these
#Option 1
def bar(*args):
pass
foo = deco(bar)
#Option2
@deco
def foo(*args):
pass
However if the decorators deco
has side effects, this is not guaranteed. In partcicular, this was my ecpectation form a decorator(no side effect), and I came across one with side effct and was bitten by it,
#Option1
def bar(*args):
pass
foo = register.filter(bar)
#Option 2
@register.filter
def foo(val, arg):
pass
So is my expectation wrong, or is django being inconsistent with the best practices?