real-life identity and "=="

Thomas Wouters thomas at xs4all.net
Sun May 14 15:50:47 EDT 2000


On Sun, May 14, 2000 at 07:17:55PM +0000, (Greg Weeks) wrote:

> I like Python enough to feel a constant itch from the one signficant
> feature I don't like.  In this note I scratch my itch.

[ Short essay on the meaning of == ]

> Among built-in types, "==" computes real-life identity for all types
> *except* lists and dictionaries.  Damn!  That is what makes me itch.
> 
> Now, I agree that comparing the *contents* of lists is sometimes useful.
> But "==" should not be the way to do it (just as "=" is not the way to copy
> contents).

> In practice, it doesn't much matter.  But it itches.  So close!

I'm not really sure, but isn't 'is' what you want ? It specifically compares
identity, not contents.

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list