How are arguments passed by value or by reference in Python?

Answer Posted / nashiinformaticssolutions

In Python, arguments are passed by assignment, meaning that the reference to an object is passed to the function. Immutable types (like integers, strings, tuples) behave like "pass-by-value" because their content cannot be modified, while mutable types (like lists, dictionaries) behave like "pass-by-reference" because their content can be modified.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is python is intended oriented?

579


Whenever python exists why does all the memory is not de-allocated / freed when python exits?

576


What is python? What do you understand of pep 8?

526


What is head and tail method for data frames in pandas ?

553


How to set the figure title and axes labels font size in matplotlib?

560






What is the difference between list and tuple?

601


Difference between python list comprehension vs. Map?

555


How does python handle memory management?

588


Why do we use __ init __ in python?

551


Can you use r in python?

567


Point out some of the key features of python?

537


Boolean have 2 possible values. Are there types in python that have 3 possible values?

595


What tuple means?

540


What does kwargs mean?

537


What are the components of python memory manager?

558