why () is () and [] is [] work in other way?
Terry Reedy
tjreedy at udel.edu
Mon Apr 23 16:06:54 EDT 2012
On 4/23/2012 1:55 PM, Devin Jeanpierre wrote:
> On Mon, Apr 23, 2012 at 1:21 PM, Benjamin Kaplan
> <benjamin.kaplan at case.edu> wrote:
>> On Mon, Apr 23, 2012 at 1:01 PM, Paul Rubin<no.email at nospam.invalid> wrote:
>> The "is" operator is perfectly defined. But it doesn't check to see
>> whether two objects hold equivalent values, it checks whether they are
>> the same thing. You're not interested in whether 20+30 and 30+20 are
>> the same object, you're interested in whether they return equivalent
>> values which should be checked with ==.
>
> The only way to check if two values are the same or not is to compare
> via is or compare the return values of id().
To quote you, 'bollocks'. The right way to compare values is with value
comparison operators.
> So you can say that is or
> id() are ill-defined, or you can say that the identity of new numbers
> is ill-defined,
'numbers' do not have identity, at least not separate from value.
Concrete computational process objects do.
--
Terry Jan Reedy
More information about the Python-list
mailing list