Re:Python, as Reviewed by a C++ Programmer
by mark-r on Sunday April 23, 2017 @01:37PM
(#14179229)
In a classic call-by-reference, changes you make to the passed parameter are seen by the caller when the function returns. That doesn't happen consistently with Python.
[ Parent
| on HN ]
I think you're just using "classic" to mean the behavior of languages like C++. Under the hood there are only two ways this mechanism can function, and I don't think it helps to mix high level language semantics in when trying to explain it, as those semantics are always expressed in one of those two ways.
I'm using "classic" to refer to the way things were done when the terms were first invented. Old languages like C or Fortran.
Python uses references implicitly without ever defining the term, so it's essential to talk about the high level semantics in this case. A Python reference (implied) differs greatly from a C++ reference in that it can be rebound with the assignment operator. If you're thinking about references in C++ terms then Python will confuse you. It's important to call out the differences.