FAQ

Shane Hathaway wrote:
Jeremy Hylton wrote: <snip>
Actually, C++ generates a compiler error if you try to do that. (See
the attached program.) Java doesn't run into this because it has a
simpler interface: the only operator you can override is equals(). So
in this case, C++ is fully explicit and Java is fully implicit, while
Python makes a guess. If we can't make it implicit like Java, then it
seems preferable for Python to raise an exception, similar to C++, when
you use the != operator with an instance that implements __eq__ but not
__ne__.

Shane
<snip>


+1
would be probably very helpful

The only problem I see is that it would break "perlish" code (code you
would not understand the behaviour of 3 weeks later). Of course some
code might never use the __ne__ of its "__eq__ overloaded class" and
therefore lived happily so far, but it is dangerous code anyway.

Regards, Ben.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 6 of 8 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedJul 8, '03 at 3:15p
activeJul 16, '03 at 7:44p
posts8
users5
websitepython.org

People

Translate

site design / logo © 2022 Grokbase