- From: Fredrik Lundh <fredrik@pythonware.com>
- Date: Tue, 15 Dec 1998 03:53:05 -0500 (EST)
- To: "John Cowan" <cowan@locke.ccil.org>, "DOM List" <www-dom@w3.org>, <xml-sig@python.org>
John Cowan wrote: > Fred L. Drake wrote: > >> Typically, >> two Python objects (let's take lists as an examples) are considered >> equal if their contents are the same; equality of two objects is not >> considered to be an unchangable characteristic. > >The trouble with that scheme is that it makes equality hard to >reason about. Intuitively, we expect equality to be transitive, >(if a = b and b = c then a = c), reflexive (a = a), and symmetrical >(if a = b then b = a). Making equality depend on mutable properties >defeats this: a might = b at one time, but a later check for >b = a might fail. Do your bank agree with you on this one? ("hey, I know there was $1000 on this account a week ago, and it's definitely the same account number!") (but sure, Python provides the "is" operator if you really want to test for object identity. Beginners seem to have trouble grasping that concept, though, so I doubt it qualifies as "intuitive"...) Cheers /F fredrik@pythonware.com http://www.pythonware.com
Received on Tuesday, 15 December 1998 03:58:57 UTC