A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2009-September/091988.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
Wed Sep 23 10:12:21 CEST 2009
Mark Dickinson wrote:
> I (still :-) think this is covered, for Python 2.x at least, by:
> 
> http://docs.python.org/reference/datamodel.html#coercion-rules

But this isn't coercion! :-)

> - For objects x and y, first x.__op__(y) is tried. If this is not
> implemented or returns NotImplemented, y.__rop__(x) is tried. 

Also, the above is not so:

Python 2.5.1
 >>> class X:
...   def __eq__(self,other):
...     print "X __eq__"
 >>> class Z: pass
...
 >>> Z()==X()
X __eq__

No __req__ in sight...

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