What other languages use the same data model as Python?
Mark Hammond
mhammond at skippinet.com.au
Wed May 4 22:09:08 EDT 2011
On 5/05/2011 11:11 AM, harrismh777 wrote:
>> The "pass by value" and "pass by reference" parameter passing
>> mechanisms are pretty well defined, and C uses "pass by value".
>
> Yeah, that's kind-a funny, cause I'm one of the guys (old farts) that helped define them....
Cool - please tell us more about your involvement in that. Obviously
lots of people were in the industry then, but only a select few would be
able to claim they helped define those terms.
> There may be some language somewhere that does pass-by-reference which
> is not implemented under the hood as pointers, but I can't think of
> any... 'cause like I've been saying, way down under the hood, we only
> have direct and indirect memory addressing in today's processors. EOS.
What about Python, where passing an integer to a function passes a
pointer to an int object, but that function is able to change the value
of the variable locally without changing the passed object (indeed, it
is impossible to change the passed integer)?
So given the definitions above, Python uses a by-reference mechanism but
(in some cases) has by-value semantics.
While I understand exactly how things work (so don't need an
explanation), the point is that for anything close to a high-level
language, things aren't as black and white as they are for the low-level
languages...
Mark
More information about the Python-list
mailing list