Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(358)

Issue 1193044: The Mapping ABC's __eq__ method should return NotImplemented if the other type is not a Mapping

Can't Edit
Can't Publish+Mail
Start Review
Created:
8 years, 9 months ago by Daniel Stutzbach
Modified:
8 years, 9 months ago
Reviewers:
Benjamin
Visibility:
Public.

Description

http://bugs.python.org/issue8729 The Mapping ABC's __eq__ method should return NotImplemented if the other type is not a Mapping, to give the other type a chance at the comparison. Right now it simply returns false. The comparison methods on the other ABCs in _abcoll.py already return NotImplemented if they don't recognize the other type.

Patch Set 1 #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+50 lines, -3 lines) Patch
M Lib/_abcoll.py View 1 chunk +3 lines, -2 lines 0 comments Download
M Lib/test/test_collections.py View 4 chunks +47 lines, -1 line 3 comments Download

Messages

Total messages: 1
Benjamin
8 years, 9 months ago (2010-05-20 22:51:37 UTC) #1
Looks mostly good.

http://codereview.appspot.com/1193044/diff/1/3
File Lib/test/test_collections.py (right):

http://codereview.appspot.com/1193044/diff/1/3#newcode253
Lib/test/test_collections.py:253: name = '__'+op+'__'
Space between the strings and +.

http://codereview.appspot.com/1193044/diff/1/3#newcode254
Lib/test/test_collections.py:254: operators['__'+op+'__'] = getattr(operator,
name)
Use the name variable again. (You could actually use a dict comp here.)

http://codereview.appspot.com/1193044/diff/1/3#newcode273
Lib/test/test_collections.py:273: if not hasattr(instance, name): continue
Put continue on another line.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b