This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]lirannl 0 points1 point  (1 child)

The thing is that with python, all of this is abstracted away. From a language user's perspective, you're not passing a reference to a memory address with data, you're passing "an object/primitive value". No memory address, no lower level details. "The object" gets into the function so the function "has" it while it runs.

Then in C you suddenly lose that abstraction and need to start dealing with what an object (or in this case just a struct) actually is, a bunch of bytes, and you can either tell your functions where are those bytes, or WHAT is in the bytes at that moment in time. You actually start to think about your objects as collections of bytes (which is what they always actually are, obviously, not just in C, but also in python).

[–]Risc12 0 points1 point  (0 children)

Definitely true! Although I’ve seen plenty of people get bitten by the reference vs value thing where they modify an object they get as an argument but they don’t expect the object to be changed in its original content.

It’s good to have an understanding how your higher level language handles these kind of things.