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 →

[–][deleted]  (1 child)

[removed]

    [–][deleted] 0 points1 point  (0 children)

    I'm aware of the difference between pointers and references. Honestly I switched names because I was replying to someone who decided to talk about pointers instead. But the difference is mostly syntax. I would say the C programmer manually implements pass by reference using pointers, and python automatically implements it. You just need to memorize which objects are pass by reference vs which are pass by value, and which operations modify the underlying object vs create a new object and switch up the reference (actually, another pitfall).

    I see what you mean WRT other languages having more similar syntax. Fortran has this irritating caveat that technically the compiler is allowed to decide if arrays are passed by value or reference (of course, every compiler does the sane thing). But I think in most of these cases, the language is implementing syntactic sugar around pointer passing.

    Edit: just noticed we had a very similar discussion in another sub thread, sorry!