Plea for __eql__
effbot at telia.com
Mon May 22 00:15:28 CEST 2000
Michael Ackerman <ack at simplyweb.net> wrote:
> Often there is only a partial order, or no natural order at all, on the
> instances of a class (eg sets, finite fields), but one still wants to
> ask whether two instances are equal (in a way appropriate for that
> type). To overload '==' for this purpose one now has to go through
> __cmp__, it seems to me, and so impose a sometimes artificial linear
> order. Wouldn't it be handy to have an __eql__ ? As things are now, it
> seems that there is no way to have '<' raise an exception without also
> having '!=' raise an exception in unwanted cases.
what you're describing is known as "rich comparisions", and
is definitely on the TODO list (1.7? 1.8? Py3K?).
for more information, see:
> Am I wrong?
don't think so. but if you are, please ignore me.
More information about the Python-list