What other languages use the same data model as Python?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu May 5 09:59:59 EDT 2011


On Thu, 05 May 2011 21:48:20 +1000, Chris Angelico wrote:

> On Thu, May 5, 2011 at 9:44 PM, Mel <mwilson at the-wire.com> wrote:
>> John Nagle wrote:
>>> On 5/4/2011 5:46 PM, harrismh777 wrote:
>>>> Or, as stated earlier, Python should not allow 'is' on immutable
>>>> objects.
>>>
>>>     A reasonable compromise would be that "is" is treated as "==" on
>>> immutable objects.
>>
>> I foresee trouble testing among float(5), int(5), Decimal(5) ...
> 
> Define 'x is y' as 'type(x)==type(y) and
> isinstance(x,(int,float,tuple,etc,etc,etc)) and x==y' then.

`is` is supposed to be a *fast* operator, not even slower than equality 
testing.



-- 
Steven



More information about the Python-list mailing list