본문 바로가기

Python/팁

파이썬 함수 호출 시 Call by Value Vs. Call by Reference

- immutuable object(int, float, str, tuple)는 call by value로

- mutuable object(list, dict, set)는 call by reference로 전달된다.

 

 

 

cf) code13.tistory.com/214

 

파이썬 함수 호출 시 참조 호출 방법 (Call by reference)

C에서는 다음과 같은 방법으로 참조 호출 방법 (Call by Reference) 를 사용 1 2 3 4 5 6 7 8 9 10 11 12 13 void dataCalc(int *data) {     *data = *data + 1; } int main() {     int data =..

code13.tistory.com

 

'Python > ' 카테고리의 다른 글

파이썬 코테에서 팁  (0) 2021.02.01