class check():
def __init__(self, func):
self.f = func
def __call__(self, *args, **kwargs):
print('登陆验证')
self.f()
def fashuoshuo():
print('发说说')
fashuoshuo = check(fashuoshuo)
fashuoshuo()
登陆验证
发说说
class check():
def __init__(self, func):
self.f = func
def __call__(self, *args, **kwargs):
print('登陆验证')
self.f()
@check
def fashuoshuo():
print('发说说')
fashuoshuo()
登陆验证
发说说