Decorator Line, Desugared

def add_prefix(func):
    def wrapper(*args, **kwargs):
        return "> " + func(*args, **kwargs)
    return wrapper

@add_prefix
def shout(word):
    return word.upper()

Which rewrite, with no @ syntax at all, produces exactly the same shout (same behavior when called, built at the same point in the module's execution)?

A

The same rewrite as the first option, except the reassignment shout = add_prefix(shout) only happens the first time shout(...) is called, not when the module loads.

B
def shout(word):
    return word.upper()

shout = add_prefix(shout)
C

def shout(word):
    return word.upper()
left as-is, with add_prefix invoked automatically on the return value each time shout(...) runs.

D
def shout(word):
    return word.upper()

shout = add_prefix