[Tutor] Variables by reference?

Jeff Shannon jeff@ccvcorp.com
Fri, 30 Nov 2001 10:18:29 -0800


> On Fri, 30 Nov 2001 10:27:15 -0500,
> "Lee-Shanok, Bruce" <Bruce.Lee-Shanok@cognos.com> wrote:
>
> Is there any way to get python to return values by reference, like a C
> pointer?

Yes, there are ways to emulate this sort of behavior, but in Python, they're usually
not the best way to approach the problem.  What is it that you're trying to accomplish
by returning a reference?

Note that, in some ways, Python variables already act a lot like C pointers--every name
is bound to (a reference to) some object.  But the specific semantics are a bit
different from C pointers (and usually much more sane).

Jeff Shannon
Technician/Programmer
Credit International