[Python-Dev] operator precedence of __eq__, __ne__, etc, if both object have implementations

Dino Viehland dinov at microsoft.com
Tue Sep 22 23:55:27 CEST 2009


Willem wrote:
> 
> It's easy for other implementations to get this wrong. :)

For IronPython we wrote a set of tests which go through and define 
the various operator methods in all sorts of combinations on both 
new-style and old-style classes as well as subclasses of those classes
and then do the comparisons w/ logging.

We've got this for both comparisons and the normal binary operators. We've
also done it in other areas such as throwing exceptions and other 
complicated areas.  But having the the coercion rules documented still 
helped a lot (although my recollection is they were only about 95% right).


More information about the Python-Dev mailing list