Understand the weirdness. How Python Passes Arguments.

Поделиться
HTML-код
  • Опубликовано: 28 сен 2024

Комментарии • 26

  • @AllenKll
    @AllenKll 2 года назад +4

    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.

    • @ClarityCoders
      @ClarityCoders  2 года назад +1

      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

  • @FrozenArtStudio
    @FrozenArtStudio 2 года назад

    such a great explanation!
    glad I set a notification for a premiere)

  • @DylanMatthewTurner
    @DylanMatthewTurner 2 года назад +2

    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.

    • @ClarityCoders
      @ClarityCoders  2 года назад

      Did you end up watching? Thanks for commenting!

    • @DylanMatthewTurner
      @DylanMatthewTurner 2 года назад

      @@ClarityCoders Yeah. Just did. That was very informative. You learn something new every day!

    • @ClarityCoders
      @ClarityCoders  2 года назад +1

      @@DylanMatthewTurner Thanks for watching! Love the Backstreet Boys cover keep it up man.

  • @emilyweston460
    @emilyweston460 2 года назад

    thanks :D excellent explanation! even on the brink of making sense for someone who started learning python 2 days ago..

  • @iraq4209
    @iraq4209 2 года назад

    Thx for the great content, i love what you do with games and its so entertaining. Keep it up man

  • @tobienortje4134
    @tobienortje4134 2 года назад

    Excellent! was wondering about this quite a bit. 👍🏻

  • @theunknown4834
    @theunknown4834 2 года назад

    All this makes me think of how does list reference its elements?

  • @awffsletmein
    @awffsletmein 2 года назад

    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.

    • @ClarityCoders
      @ClarityCoders  2 года назад +1

      I actually show that example later but both create a new object. Sense integers are immutable!

  • @eranfeit
    @eranfeit 2 года назад

    Thanks

  • @freeeshorts9063
    @freeeshorts9063 2 года назад

    Bro make zooba game Ai plzzzz

  • @nick-oi1xf
    @nick-oi1xf 8 месяцев назад

    Try changing all your friends in the list. It won't😂.

  • @pixelbogpixxelbog2090
    @pixelbogpixxelbog2090 2 года назад +2

    .

  • @PERSISTENTxMF
    @PERSISTENTxMF 2 года назад +4

    Error: See line 41
    Line 41: (blank)

    • @ClarityCoders
      @ClarityCoders  2 года назад

      but I only have 30 lines!?

    • @PERSISTENTxMF
      @PERSISTENTxMF 2 года назад

      @@ClarityCoders hah! Maybe it's line 41 of one of the modules you imported? :D

  • @johndorian4078
    @johndorian4078 2 года назад

    But im assuming you can pass the id? or make a variable a global variable in python like you can other languages?

  • @zakyvids6566
    @zakyvids6566 2 года назад

    Can you make a python crash course

  • @freezerain
    @freezerain 2 года назад

    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

  • @jakelionlight3936
    @jakelionlight3936 2 года назад

    :) So you like the Cubs, Stephen king and your human child is an aspiring artist.
    What are the other two books?

    • @ClarityCoders
      @ClarityCoders  2 года назад

      Bag of Bones, The Stand are both on that self I know my two favorite books both by Stephen King.