[Python-Dev] operator precedence of eq, ne, etc, if both object have implementations (original) (raw)
Jared Flatow jflatow at gmail.com
Tue Sep 22 16:20:04 CEST 2009
- Previous message: [Python-Dev] operator precedence of __eq__, __ne__, etc, if both object have implementations
- Next message: [Python-Dev] operator precedence of __eq__, __ne__, etc, if both object have implementations
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 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?
jared
On Sep 22, 2009, at 7:06 AM, Chris Withers wrote:
Hi All,
I didn't see any docs on this: http://docs.python.org/reference/datamodel.html?highlight=eq#object._eq Where are the specifications on what happens if two objects are compared and both have implementations of eq? Which eq is called? What happens if the first one called returns False? Is the second one called? What is one implements eq and the other ne? If I've missed something, please point me in the right direction. To all those about to tell me to go read the source: that's not good enough here. I'm hoping there are "official" rules for how these interact and they just need better linking in, otherwise, I worry that IronPython could do one thing, Jython another and CPython a third... cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk
Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/jflatow%40gmail.com
-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20090922/5d2ffc0f/attachment.htm>
- Previous message: [Python-Dev] operator precedence of __eq__, __ne__, etc, if both object have implementations
- Next message: [Python-Dev] operator precedence of __eq__, __ne__, etc, if both object have implementations
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]