What other languages use the same data model as Python?
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Thu May 5 10:51:52 EDT 2011
On Wed, 04 May 2011 16:22:42 -0600, Ian Kelly wrote:
> However, I hope we can all agree that pass-by-pointer shares certain
> features with both pass-by-value and pass-by-reference, and there are
> perfectly reasonable arguments for lumping it in either category, yes?
*cries*
Please don't invent another "pass by foo" term!!!!
Seriously though, "pass by foo" refers to what the compiler or
interpreter does when you, the coder, call a function with some variable,
say, x:
f(x)
It is not referring to what you, the coder, does when you want to pass an
indirect reference of some sort to a chunk of data to some function. In
many languages, you would use a pointer, and write the function call
something like this:
f(^x)
(using Pascal's up-arrow notation for "pointer to").
Such "pass by pointer" is a tactic used by the coder, as opposed to a
language feature.
I believe this distinction between what the compiler does, and what the
coder does, is at the heart of much confusion. Pointers that are passed
as arguments are themselves data, just as much as ints or floats, or (in
languages that have first-class functions) functions.
--
Steven
More information about the Python-list
mailing list