python에선 some_function(a,b)(x)처럼 소괄호가 두번 나오는 것이 있다. 처음보면 함수포인터랑 비슷하게 생겼는데 잘 모르겠는 무언가일 것이다. some_function의 내부를 뜯어보면 답이 나온다.
def some_function(a, b):
def another_function(x):
print(a+b+x)
return another_function
some_function은 함수를 리턴하고 따라서 리턴한 함수에 x라는 값을 준 것이다.
'컴퓨터' 카테고리의 다른 글
[Python] 주피터 노트북 커널이 자꾸 죽을때 (0) | 2022.01.22 |
---|---|
[Tensorflow] Blas xGEMV launch failed 오류 해결법 (0) | 2022.01.21 |
[Linux] initramfs가 떴을때... 대처법 (0) | 2022.01.20 |
[Linux] 갑자기 리눅스가 멈췄을때 대응법(Magic SysRq Key) (0) | 2022.01.19 |
리눅스 &&, ||, &, ; 차이점 정리 (0) | 2022.01.04 |