본문 바로가기
Languages/Python

파이썬 데코레이터(Decorator)

by chuckolet 2019. 4. 9.


Introduction

파이썬에서 @, decorator를 알아봤습니다.

데코레이터라는 말 자체는 특정 함수나 클래스를 꾸며준다는 뜻이지만

실제로 동작하는 모습을 보면 @로 시작하는 특정 annotation 이름의 함수나 클래스에 인자로

해당 annotation이 달린 함수를 집어 넣는 느낌입니다.

아래 코드를 보면 좀 더 이해가 잘되실거라고 생각합니다!

Contents

References

 

파이썬 데코레이터 (decorator): 기초편

파이썬 코드를 보다보면 가끔 함수 이름 위에 @로 시작하는 구문이 붙어 있는 것을 가끔 볼 수 있다. @verbose def my_function(): print "hello, world." 만약 자바를 주로 사용하는 프로그래머라면 어노테이션(a..

trowind.tistory.com

 

*args and **kwargs in python explained

Hi there folks. I have come to see that most new python programmers have a hard time figuring out the *args and **kwargs magic variables. So what are they ? First of all let me tell you that it is …

pythontips.com

 

댓글