Annoying behaviour of the != operator

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Jun 8 23:35:30 EDT 2005


Jordan Rastrick wrote:

> But I explicitly provided a method to test equality.

Actually, no, you didn't. You provided a method to define
the meaning of the operator spelled '==' when applied to your
object. That's the level of abstraction at which Python's
__xxx__ methods work. They don't make any semantic assumptions.

It's arguable that there should perhaps be some default
assumptions made, but the Python developers seem to have
done the Simplest Thing That Could Possibly Work, which
isn't entirely unreasonable.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list