Notice
Recent Posts
Recent Comments
Link
목록Decorator (1)
허허의 오늘은 뭐 먹지?
[python] python decorator
python의 decorator는 함수 객체를 입력받아 새로운 함수 함수 객체(decorated function)을 만들어준다. num1 = 3 num2 = 8 def call_test(func): def wrapper(): print(f"called func : {func.__name__} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") print(f"before call func. num1 --> {num1}, num2 --> {num2}") func() print(f"after call func. num1 --> {num1}, num2 --> {num2}") return wrapper def first(): # global로 num을 변경할 수 있다. global num1 num..
SW/메모
2023. 2. 4. 23:20