filmov
tv
Pass By Reference in Python | EP-53 Call By Reference in Python | Python Tutorial for Beginners

Показать описание
Here both actual and formal parameter refers to same memory location.Therefore any changes made to
the formal parameter will get reflected to actual parameter.In this case instead of passing value we
pass address
def modify_list(my_list):
my_list =[1,2,3]
modify_list(my_list)
print(my_list)
print(id(my_list))
#python #pythonprogramming #pythontutorial #python3 #pythonbeginner #programming #developer #coding #tutorial #passbyreference #passbyvalue #mutability #immutability #functioncalls #memorymanagement #pythontips #pythontricks #PythonBeginners #CallByReference #PythonBasics
the formal parameter will get reflected to actual parameter.In this case instead of passing value we
pass address
def modify_list(my_list):
my_list =[1,2,3]
modify_list(my_list)
print(my_list)
print(id(my_list))
#python #pythonprogramming #pythontutorial #python3 #pythonbeginner #programming #developer #coding #tutorial #passbyreference #passbyvalue #mutability #immutability #functioncalls #memorymanagement #pythontips #pythontricks #PythonBeginners #CallByReference #PythonBasics