classification
Title: set.__eq__ returns False when it should return NotImplemented
Type: behavior Stage: resolved
Components: Build Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: r.david.murray, rhettinger, serhiy.storchaka, zelaznik
Priority: normal Keywords:

Created on 2015-06-08 15:50 by zelaznik, last changed 2015-06-08 23:13 by serhiy.storchaka. This issue is now closed.

Messages (3)
msg245009 - (view) Author: Steve Zelaznik (zelaznik) Date: 2015-06-08 15:50
[in] >>> d = {'x':3,'y':4,'z':5}
  [in] >>> set(d.items()) == d.viewitems()
 [out] >>> False
  [in] >>> d.viewitems() == set(d.items())
 [out] >>> True
  [in] >>> set(d.items()).__eq__(d.viewitems())
 [out] >>> False

The last line should return NotImplemented rather than False.  This problem seems to have been addressed in Python3.
msg245024 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-06-08 17:07
See issue 21408 for the fix, which was indeed not applied to 2.7.  Now we get to decide if it should be :)
msg245041 - (view) Author: Steve Zelaznik (zelaznik) Date: 2015-06-08 22:40
On second thought, it looks like somebody may have caught the problem at or before Python 2.7.9.

My PC at work has 2.7.6 which is where I spotted the problem.  My mac at home has 2.7.9 where it worked fine.

Steve Zelaznik
410.375.8414
Sent from either an
iPhone or an Android

> On Jun 8, 2015, at 1:07 PM, R. David Murray <report@bugs.python.org> wrote:
> 
> 
> R. David Murray added the comment:
> 
> See issue 21408 for the fix, which was indeed not applied to 2.7.  Now we get to decide if it should be :)
> 
> ----------
> nosy: +r.david.murray
> 
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue24410>
> _______________________________________
History
Date User Action Args
2015-06-08 23:13:37serhiy.storchakasetstatus: open -> closed
resolution: out of date
stage: resolved
2015-06-08 22:40:47zelazniksetmessages: + msg245041
2015-06-08 17:07:58r.david.murraysetnosy: + r.david.murray
messages: + msg245024
2015-06-08 15:51:52serhiy.storchakasetnosy: + rhettinger, serhiy.storchaka
2015-06-08 15:50:47zelaznikcreate