---
title: "How does Python handle arguments in functions (pass-by-value or pass-by-reference)?"  
description: "How does Python handle arguments in functions (pass-by-value or pass-by-reference)?"  
author: "ICSM Computer"  
published: 2025-03-27  
updated: 2025-04-15  
canonical: https://www.mindstick.com/forum/161375/how-does-python-handle-arguments-in-functions-pass-by-value-or-pass-by-reference  
category: "python"  
tags: ["python"]  
reading_time: 2 minutes  

---

# How does Python handle arguments in functions (pass-by-value or pass-by-reference)?

How does Python [handle](https://www.mindstick.com/articles/311004/suede-skillet-handle-cover) [arguments](https://answers.mindstick.com/qa/92535/what-are-the-different-types-of-arguments) in [functions](https://www.mindstick.com/forum/160140/explain-the-role-of-functions-as-a-service-faas-in-serverless-computing) (pass-by-[value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) or pass-by-[reference](https://www.mindstick.com/forum/774/reference-what-does-this-error-mean-in-php))?

## Replies

### Reply by Khushi Singh

The memory transmission mechanism in Python combines features from both pass-by-value and pass-by-reference into what is best described as “**pass-by-object-reference**” or “**pass-by-assignment**”. Functions accept argument references only instead of receiving the original objects when they are invoked. The ability to modify objects by functions depends on the object type since mutable elements allow modifications while immutable elements do not.

A mutable object passed to a function allows changes made within the function to modify both the original object located outside the function boundaries. Assigning a new object through the function parameter has no effect on the initial object stored outside the function.

Modification attempts on immutable objects within a function do not impact the original object outside the function because the function instead binds a new object reference to its local scope.

Understandably this operational style causes ambiguity when developers expect Java-like value passing or C++-like reference copying behaviors. Inside Python functions users can receive object references but the function prevents modifications of these references by external code.

Code Example

```python
def modify_list(lst):
   lst.append(4)  # modifies the original list
def modify_number(num):
   num += 10  # creates a new number object, original remains unchanged
my_list = [1, 2, 3]
my_num = 5
modify_list(my_list)
modify_number(my_num)
print(my_list)  # Output: [1, 2, 3, 4]
print(my_num)   # Output: 5
```

The example shows the list becomes modified since it is mutable yet the integer stays unchanged because it is immutable.


---

Original Source: https://www.mindstick.com/forum/161375/how-does-python-handle-arguments-in-functions-pass-by-value-or-pass-by-reference

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
