
IT/파이썬 2021. 5. 20.
파이썬 - 함수 전달인수에 * 가 있다면 멀까?
아래 글 보다 더 잘 설명할 순 없다. 그냥 아래 글에 들어가셔용~~ https://sjquant.tistory.com/31?category=797018 파이썬에서 arguments로 *(별표)만 쓴 경우!? fastapi 의 코드를 보던 중 함수의 arguments 로 *만을 쓴 것을 발견했다. 난생 처음 본 표현법이라서 직접 테스트 해보며 뭔지 알아냈다. ...(생략) def get_param_sub_dependant( *, param: inspect.Parameter,.. sjquant.tistory.com *를 사용하면 *이후의 arguments들을 keyword arguments로 강제할 수 있다. 예를들어 아래와 같이 정의한 경우에는 recipient와 what을 positional argum..
