廖雪峰python3 decorator思考

廖雪峰Python3
再思考一下能否写出一个@log 的 decorator,使它既支持:
@log
def f():
pass
又支持:
@log('execute')
def f():
pass

答案如下:

def log(text):
    def outer(func):
        def wrapper(*args,**kwargs):
            print('begin call')
            res = func(*args,**kwargs)
            print('end call')
            return res
        return wrapper
    if isinstance(text,str):
        return outer
    else:
        return outer(text)     #为什么要加参数text

请问最后一行为什么要加上参数text, 不理解啊,

我感觉写错了