Try it here
Subscribe
Pass by reference and value

Python's parameter-passing mechanism

python_parameter-passing_mechanism

To pass its parameters to a function, Python uses pass-by-reference.

If you change a parameter within a function, the change reflects in the calling function. This is its default behavior.

However, when we pass literal arguments like strings, numbers, or tuples, they pass by value. This is because they are immutable.

Writer profile pic

Anmol on Apr 19, 2020 at 02:04 am


This article is contributed by Anmol. If you like dEexams.com and would like to contribute, you can write your article here or mail your article to admin@deexams.com . See your article appearing on the dEexams.com main page and help others to learn.



Post Comment

Comments( 0)

WEB TECHNOLOGY

Articles

×

Forgot Password

Please enter your email address below and we will send you information to change your password.