Everything is an object in python - object class and type class

BartC bc at freeuk.com
Wed Jun 3 13:26:47 EDT 2015


On 03/06/2015 17:36, Michael Torrie wrote:
> On 06/03/2015 10:00 AM, BartC wrote:
>> The others all give True in all cases. It seems that older Python
>> versions have a purer object model.
>
> No.  It's just an under-the-hood optimization that the interpreter is
> making.  It's an implementation detail that you should never rely on.
> It says nothing about the purity of the object model.  Immutable objects
> can be optimized ("interred" is the word often used) by reusing the same
> object over and over when the interpreter can.

But (-12 is -12) yielding False was being used to illustrate why Value 
and Object didn't mean the same thing.

Are they in fact the same, or is there something else that can be done 
more reliably to show the difference?

(However, I feel the internal representation of values shouldn't matter. 
Each type of value will have its own documented behaviour.)

-- 
Bartc





More information about the Python-list mailing list