문제 설명
python ‑ 메소드 이름에 대한 미리 정의된 내장 (python ‑ predefined builtlin for method name)
파이썬에서 함수 이름에 대해 미리 정의된 내장 기능이 있습니까?
예:
- 모듈 이름 '이름'을 미리 정의했습니다.
- 파일 이름 'file'에 대한 내장이 있습니다.
마찬가지로 로깅 기능에 추가하기 위해 메소드 이름에 대한 내장을 찾고 있습니다. .
참조 솔루션
방법 1:
If I get it correct, to get the function name, you can use __name__
of the function.
E.g: function_name.__name__
</p>
You can find more about this over here
(by SunilS、Sreejith Nair)