I have the following 3 functions:
def dec1(func): return func def dec2(): return dec1 def dec3(): return dec2
If I apply the
@ decorator syntax to a function then:
@dec1works as expected.
@dec2()works as expected.
Just by looking at it, 3 seems that it shouldn’t be that different than 2 (which seems not that different than 1). So why then is it a syntax error?
Of course, not using the
@ syntax (e.g.
foo = dec3()()(foo)) works as expected.