Annoying behaviour of the != operator

Jordan Rastrick jrastrick at student.usyd.edu.au
Wed Jun 8 14:55:27 EDT 2005


I'd suggest the only nessecary change is, if objects a,b both define
__eq__ and not __ne__, then a != b should return not (a == b)

If a class defines __ne__ but not __eq__, well that seems pretty
perverse to me. I don't especially care one way or another how thats
resolved to be honest.

The ordering comparisons (__lt__, __ge__ etc) are fine as they are I'd
say, since they only come up in the rare cases where __cmp__ isn't
sufficient.

I'll wait for a bit more discussion on here before starting a PEP - as
I've said I'm only a beginner, and a more experience Pyonista may yet
give a perfectly good argument in favour of the current behaviour.




More information about the Python-list mailing list