[Python-Dev] operator precedence of __eq__, __ne__, etc, if both object have implementations
Chris Withers
chris at simplistix.co.uk
Tue Sep 22 16:37:42 CEST 2009
More information about the Python-Dev mailing list
Tue Sep 22 16:37:42 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 ]
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
- 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 ]
More information about the Python-Dev mailing list