why () is () and [] is [] work in other way?
Robert Kern
robert.kern at gmail.com
Mon Apr 23 20:18:59 EDT 2012
On 4/24/12 1:03 AM, Tim Delaney wrote:
> On 24 April 2012 09:08, Devin Jeanpierre <jeanpierreda at gmail.com
> <mailto:jeanpierreda at gmail.com>> wrote:
>
> On Mon, Apr 23, 2012 at 6:26 PM, Tim Delaney
> <timothy.c.delaney at gmail.com <mailto:timothy.c.delaney at gmail.com>> wrote:
> > And doing that would make zero sense, because it directly contradicts the
> > whole *point* of "is". The point of "is" is to tell you whether or not two
> > references are to the same object. This is a *useful* property.
>
> It's useful for mutable objects, yes. How is it useful for immmutable
> things? They behave identically everywhere where you don't directly
> ask the question of "a is b" or "id(a) == id(b)".
>
>
> Not always. NaNs are an exception - they don't even compare equal to themselves.
> And hence a very good reason why "is" and == are separate operations.
I think you misread what Devin wrote. "id(a) == id(b)" not "a == b".
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list