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

Steven D'Aprano steve at REMOVETHIScyber.com.au
Sun Jan 15 02:16:44 EST 2006


On Sat, 14 Jan 2006 23:26:40 -0500, Mike Meyer wrote:

> Steven D'Aprano <steve at REMOVETHIScyber.com.au> writes:
>> On Sat, 14 Jan 2006 18:26:41 -0500, Mike Meyer wrote:
>>> If two objects ARE the same value, then they should be the same
>>> object. 
>> You are assuming that values are unique, and that therefore is X "is" (in
>> the English sense, not the Python sense) some value, then no other thing Y
>> can also be the same value.
> 
> I would say that's a valid definition of value.

Perhaps it is, in some contexts. But I dispute that it is true in all
contexts. It depends on whether you CHOOSE to demand that values are
unique or not.

>>> x = 2000
>>> y = 1000 + 1000
>>> x is y
False
>>> x == y
True

This causes me no trouble at all. Two instances of the same value, no big deal.



>> 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.


-- 
Steven.




More information about the Python-list mailing list