Is 'everything' a refrence or isn't it?
Max
rabkin at mweb[DOT]co[DOT]za
Wed Jan 18 02:06:18 EST 2006
Terry Hancock wrote:
> On Sat, 07 Jan 2006 01:29:46 -0500
> Mike Meyer <mwm at mired.org> wrote:
>
>>From what I can tell, Liskov proposed *three* different
>>names for
>>passing references to objects: call-by-sharing,
>>call-by-object, and call-by-object-reference.
>
>
> "Call by object reference" makes the most sense to me. Names
> in Python are object references: they refer to objects. You
> might almost say "call by name" but that sort of implies
> that you are passing the strings around (which is generally
> untrue), and it doesn't convey what happens when the name is
> something complex like "ham['spam'][0].eggs()[42]" (i.e.
> "name" carries the conotation of being a simple string,
> although you could argue that it doesn't have to mean that).
>
Except that what is passed is not "ham['spam'][0].eggs()[42]" -
that's the *name of where one copy of the objects name is*. The
name is ham['spam'][0].eggs()[42].id() - usually something like
0xBEEFBABE.
When I fill in a form (say if I applied for a visa) - three
things could happen:
a) Pass by object reference/name: I write "8x0323xxxxxx081" (my
ID number) or "Max Xxxxx Rabkin" (my name) on the form, so they
know who I am.
b) Your method (pass by container reference?): I write
"The youngest male living at:
32 Xyz Road
Rondebosch
Cape Town".
They know who I am, until I move house or I get a baby brother.
c) Pass by value: I staple myself to the form. Painful, but
it works. Unless I need a vaccination for the visa. Then I have
to make a copy of myself; one copy gets vaccinated while the
other is getting the visa. Unfortunately, I still can't get
into Italy, because the guy with the visa doesn't have a
vaccination and vice versa.
--Max
More information about the Python-list
mailing list