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

Steven D'Aprano steve at REMOVETHIScyber.com.au
Sat Jan 14 18:08:37 EST 2006


On Sat, 14 Jan 2006 17:33:07 -0500, Mike Meyer wrote:

> Steven D'Aprano <steve at REMOVETHIScyber.com.au> writes:
>> On Sat, 14 Jan 2006 04:22:53 +0000, Donn Cave wrote:
>>> |> 2. What is the value of object()?
>>> [ I assume you mean, the object returned by object(). ]
>>> It doesn't really have a value.  I can't think of any kind of
>>> computation that could use this object directly.
>> Here is one:
>> obj_inst = object()
>> def computation(data):
>>     global obj_inst
>>     if data is obj_inst:
>>         print FirstOneThousandPrimes()
>>     else:
>>         print TextOfWarAndPeace()
>> It isn't a particularly useful computation, but it is a computation.
> 
> And it doesn't use the value of the object instance, it uses it's
> identity. Any type that doesn't have hacks to share instances with the
> same value could be used in this way.

Since it is my position that the identity of an instance of object() _is_
its value, your argument doesn't concern me whatsoever. 

object instances are like electrons (note for pedants: in classical
physics, not QED): they are all exactly the same, distinguishable only by
their position in time and space (or memory location).


-- 
Steven.




More information about the Python-list mailing list