A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-September/091955.html below:

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

[Python-Dev] operator precedence of __eq__, __ne__, etc, if both object have implementationsChris Withers chris at simplistix.co.uk
Tue Sep 22 16:37:42 CEST 2009
Jared Flatow wrote:
> This might help:
> 
> http://mail.python.org/pipermail/python-dev/2008-June/080111.html
> 
> Here is the most relevant part (quoting Guido):
> 
>  > Does it help if I tell you that for "x <binop> y" we always try
>  > x.__binop__(y) before trying y.__reverse_binop__(x), *except* in the
>  > case where y is an instance of a subclass of the class of x?

Okay, but does that count as a pronouncement that should go across all 
versions and platforms?

I believe there are differences between when __eq__ and __ne__ are 
called between Python 2 and 3, and I don't see any docs on the expected 
behaviour for python 2, dunno about 3.

I'm willing to write these docs, 
http://docs.python.org/reference/datamodel.html#object.__eq__ feels like 
the right place, is there anywhere else they should go or be linked to from?

Mark Dickinson gave some useful insights into this, and Milko Krachounov 
provided these useful comparisons on #python:

Python 2
http://pastebin.com/f8f19ab3

Python 3
http://pastebin.com/f55e44630

Do they cover it all or has anything been missed?

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4