Is 'everything' a refrence or isn't it?

Steven D'Aprano steve at REMOVETHIScyber.com.au
Sun Jan 15 05:23:48 EST 2006


On Sun, 15 Jan 2006 03:11:27 -0500, Mike Meyer wrote:

> Steven D'Aprano <steve at REMOVETHIScyber.com.au> writes:
>> On Sat, 14 Jan 2006 23:26:40 -0500, Mike Meyer wrote:
>>>> I have no problem with that. Some objects are mutable and can change
>>>> their value
>>> If the object *is* the value, how can it change to be a different value
>>> without also changing to be a diffent object?
>> Because that's what they do.
>> Think of it this way: objects are the memory location, the value is the
>> particular pattern of bits at that memory location. Just because you flip
>> a couple of bits at location N, changing the value, the location doesn't
>> change.
> 
> Ok. So when you say "the object is the value", you're *really* saying
> "the memory location is the pattern of bits it holds."

No. You seem to have trouble with analogies. My apologies for not making
it clearer: I should have said, by analogy, the relationship between
mutable objects and their value is equivalent to the relationship between
a memory location and the bit pattern at that location.


> Except that a
> memory location is an address, which is a pattern of bits.  In general,
> this won't be the same pattern of bits as the memory location holds. So
> you're actually claiming that an object is two different patterns of
> bits at the same time.

I'm not claiming that at all, but I don't have any problem with the
concept of certain objects being two or more things simultaneously.
Prince Charles, for example, is simultaneously Queen Elizabeth's son,
Diana's widower, Harry and William's father, Camilla's husband, and many
more things besides. 

It isn't common for programming data to have multiple values
simultaneously, but it does happen: a certain value can be a pointer to a
memory location and an integer, or a numeric value and a character.



-- 
Steven.




More information about the Python-list mailing list