# - * - coding: utf- 8 - * - Universal # decorator with universal parameters DEF check_with_para (args2 *, ** kwargs2): DEF Check (Fn): DEF Inner (* args, ** kwargs): Print ( "password authentication is completed, through, args =% S, S% = kwargs"% (args, kwargs)) IF "haha" == args2 [0]: return Fn (* args, ** kwargs) elif "Hehe" args2 == [. 1]: Print ( "where you can do something different from other processes. 1") return Fn (* args, ** kwargs) the else: Print ( "where you can do some other different processing 2") return Fn ( args *, ** kwargs) return Inner return the Check function # 1 first execution check_with_para ( "haha"),Return check references # 2 and then performs @check # 3.Use @check decorated for f1 @check_with_para ( "haha") DEF F1 (N1, N2): Print ( "function execution 1") return N1 + N2 @check_with_para ( "Hehe", 1) DEF F2 (N1, N2 , N3): Print ( "execution function 2") return N1 - N2 * N3 @check_with_para ( "heihei", 2, True) DEF F3 (): Print ( "execution function 2") IF the __name__ == '__main__ ': Print (F1 (. 7,. 8)) Print (F2 (. 1,. 4, 2)) Print (F3 ())