Finding the instance reference of an object
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Thu Oct 30 21:56:11 EDT 2008
On Thu, 30 Oct 2008 09:03:42 -0600, Joe Strout wrote:
> Python's behavior is exactly and always equivalent to the "ByVal"
> behavior of languages that have both behaviors.
Pascal has both ByVal and By Ref, and Python's behaviour is absolutely
not the same as Pascal's ByVal.
> It also matches the definition of call-by-value.
Which definition of call-by-value? Certainly not the one that most people
are familiar with, where c-b-v implies that calling a function with a
large array will copy the entire array.
> I quite agree that it's not helpful to
> delve into the physical flipping of transistor states.
Nor is it helpful to delve into the implementation details of pointers
and references. There are no such things in Python code, and the Python
virtual machine doesn't see them. Only the underlying implementation sees
them, and as Fuzzyman has already explained, the .Net implementation of
IronPython differs from the C implementation of CPython, and this has
real consequences for Python code exposed to .Net objects.
> We're talking
> about the behavior, and the behavior, very clearly, is call-by-value.
Only if you redefine c-b-v to something that it unrecognizable to anyone
else.
Joe, you've got a cheek sneering at us for inventing new terms (that we
didn't in fact invent, that have a long history in the IT field, one
involving such giants as Barbara Liskov) when your entire argument rests
on the hijacking of the word "value" to mean "some arbitrary,
implementation-dependent reference to the thing which is the actual
value".
It is an abuse of language and common sense to claim that after executing
x=42, the "value" of x is 149605700 (or whatever arbitrary memory
location you happen to get). That nonsensical idea is the bedrock of your
entire argument.
--
Steven
More information about the Python-list
mailing list