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
'Languages > Python' 카테고리의 다른 글
[공유] [점프 투 파이썬] 정규 표현식 시작하기 (0) | 2019.03.15 |
---|---|
Python으로 bash 명령 실행하기(os.system, subprocess) (0) | 2019.01.14 |
[공유] 파이썬에서 if __name__ == "__main__"을 쓰는 이유 (0) | 2018.12.12 |
댓글