DAvideo
alle Bilder sehen ;)
Designed by: Hinx3
OSWD 2004

Valid HTML 4.01!

Difference between Pass by Value, Pass by Reference | #python

· 30.06.2023 · 16:30:08 ··· ··· Friday ·· 5 (5) Jovian
📍 📍 Did you know the way you pass arguments to a function can make a huge difference in your code? Let's explore. Pass by value, pass by reference, and how Python handle these concepts.

  📍 When you pass an argument by value, a copy of the value is sent to the function.

Any changes made within the function doesn't affect the original variable.

 When you pass an argument by reference,

you are passing the memory address of the variable.

Changes made within the function directly affect the original variable

 now these concepts are very commonly used in languages like 📍 C, 📍 C plus plus 📍 PHP, et cetera, but

python uses pass by object reference.

Variable holds reference to objects

when passing arguments. References to these objects are passed.

Mutable objects like   📍 list   📍 dictionaries can be modified within the whereas immutable 📍 📍 objects like strings cannot.

 So Python doesn't strictly use pass by value or passed by difference. It has its unique approach.


· 01.01.1970 · 01:00:00 ···
0**##
🧠 📺

· 01.01.1970 · 01:00:00 ···
# · 01.01.1970 · 01:00:00 ···
* · 01.01.1970 · 01:00:00 ···
* · 01.01.1970 · 01:00:00 ···

********