passing by refference

Terry Reedy tjreedy at udel.edu
Thu May 15 17:38:34 EDT 2003


"Joshua Marshall" <joshway_without_spam at myway.com> wrote in message
news:ba0iqp$a0b$1 at ginger.mathworks.com...
> It's only here that I disagree with you.  I consider Python values
> themselves to be object references, which are simply copied/assigned
> to the formal parameters upon function invocation.

To me and, I believe, most pythoneers, the value of an int object is
its integer value: ..., -1, 0, 1, ... .  The value of a string object
is its sequence of bytes.  A 'reference' to a Python object is *not* a
Python object.  It is whatever a non-godly interpreter, human or
machine, needs to associate (non-object) names and container object
slots with Python objects.

> Where I do agree with you is that it's an implementation detail that
> these object references are implemented as C pointers.

Only in the C-coded interpreter.  The Java-coded interpreter does
something else.  No one seems to know quite how we humans associate
name with objects or if 'reference' will be part of some future
description.

> Ok, enjoyable conversation, but I think we're starting to retread
old
> ground.

So let me inject a somewhat different thought.  C, for example, is
pretty explicitly a language for computer execution: variables are
sized blocks of memory with integer addresses subject to addition and
subtraction.  (I am aware of the Intel exception, and of non-standard
kludges like 'near' and 'far'.)  Python is a more general algorithm
language defined in terms of names, typed information units (objects),
undefined, interpreter-implemented, 'associations' between the two,
and operations on the information values.  It is optimized more for
human interpretation than execution speed, but, unlike algorithm
pseudocodes, is also machine interpretable.  That's why I dubbed it
'executable pseudocode' over 6 years ago.   (The semi-oxymoronic irony
was intentional).  While some may not like this viewpoint, others like
me find it useful, which is what viewpoints are about.

Terry J. Reedy






More information about the Python-list mailing list