real-life identity and "=="
Michael Hudson
mwh21 at cam.ac.uk
Sun May 14 15:32:43 EDT 2000
weeks at golden.dtc.hp.com ((Greg Weeks)) writes:
[schnipp]
> 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!
>
> Greg
>
> PS: Java has a similar problem. For BitSets for example, the equals() and
> hashCode() methods erroneously assume immutability. Again, so close.
Common Lisp has eq, eql, equal and equalp which are all different ways
of testing equality - and that's probably not enough for a completely
general solution. There is a reason for this; equality is not as
clearly a defined operation as one might think.
BTW, eql is almost exactly what you are asking for in Python.
unhelpful-ly y'rs
m.
--
40. There are two ways to write error-free programs; only the third
one works.
-- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html
More information about the Python-list
mailing list