![[Python] decorator를 이용한 함수의 doc string 구하기](https://img.zoomtrend.com/2018/05/11/a0105618_5af51bcba48b8.png)
파이썬에서 데코레이터에 대한 고찰을 확인해 본 적이 있습니다만,아래와 같은 아주 간단한 데코레이터를 이용한 foo 라는 함수가 있다고 가정합니다. def decorator1(f): def _decorator(): print('decorator active') f() return _decorator @decorator1def foo(): """the magic foo function""" print('this is function foo') print('foo.__doc__="%s"' % foo.__doc__) 위에서 foo 함수위에 @decorator1 라는 데코레이터가 없다면 print('foo.__doc__="%s"' % foo.__doc__