Understand the weirdness. How Python Passes Arguments.
Vložit
- čas přidán 4. 08. 2024
- Mutable and Immutable types makes this Python discussion very confusing. In this video we will reference a great article in Python Weekly to understand how Python Passes arguments. This Python Discussion is suitable for all levels of Python programmers and many advanced programmers may disagree with me! Join the conversation in the comments.
📗Article Link📖
mathspp.com/blog/pydonts/pass...
💬Want to talk to me and other programmers?📞
Join our discord: / discord
🎓Contents of the Video🎓
0:00 Intro
0:31 Not by Reference or Value
4:32 Immutable and Mutable Objects
8:28 Pass by Assignment - Věda a technologie
such a great explanation!
glad I set a notification for a premiere)
Thx for the great content, i love what you do with games and its so entertaining. Keep it up man
looks like pass by reference to me... it's just that certain objects can't be changed- which has nothing to do with how it's passed to a function, and more how assignment works in python. Still a great video! I just disagree with the conclusion.
That's the discussion I wanted to spur on actually. Python.org does use the pass by assignment terminology though see these docs. docs.python.org/3/faq/programming.html#how-do-i-write-a-function-with-output-parameters-call-by-reference
Excellent! was wondering about this quite a bit. 👍🏻
thanks :D excellent explanation! even on the brink of making sense for someone who started learning python 2 days ago..
Thanks
Before watching the video I'd say pass by value with an asterisk.
That asterisk being that every Python variable is a pointer I think, so you're passing pointers by value, which in C would be how you pass something by reference as well to some extent.
Did you end up watching? Thanks for commenting!
@@ClarityCoders Yeah. Just did. That was very informative. You learn something new every day!
@@DylanMatthewTurner Thanks for watching! Love the Backstreet Boys cover keep it up man.
But im assuming you can pass the id? or make a variable a global variable in python like you can other languages?
Can you make a python crash course
Error: See line 41
Line 41: (blank)
but I only have 30 lines!?
@@ClarityCoders hah! Maybe it's line 41 of one of the modules you imported? :D
Just like java I guess. I always missing in those languages an ability to control pass type like with c++ pointers. But then I remember that pass by value is practically useless
All this makes me think of how does list reference its elements?
Assignment like age = 26 would not change the object anyways, it just replaces the old object with a new one. The age += 10 would be better example because it roughly translates to age.__iadd__(10) method call on the original object, possibly modifying it.
I actually show that example later but both create a new object. Sense integers are immutable!
Bro make zooba game Ai plzzzz
:) So you like the Cubs, Stephen king and your human child is an aspiring artist.
What are the other two books?
Bag of Bones, The Stand are both on that self I know my two favorite books both by Stephen King.
Try changing all your friends in the list. It won't😂.
.
Thanks I agree.