[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I don't know if it is worth to backport this feature (dict views were registered in 1f024a95e9d9), but the patch itself LGTM. I think tests should be foreported to 3.x (if they don't exist in 3.x). Are there generic set tests similar to mapping_tests and

[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-26 Thread Roundup Robot
Roundup Robot added the comment: New changeset ff8b603ee51e by Raymond Hettinger in branch 'default': Issue #24286: Forward port dict view abstract base class tests. https://hg.python.org/cpython/rev/ff8b603ee51e -- ___ Python tracker

[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-26 Thread Raymond Hettinger
Raymond Hettinger added the comment: I don't know if it is worth to backport this feature I don't think so either. The Iterator registry is a bit of a waste. Are there generic set tests similar to mapping_tests and seq_tests? Not that I know of. Also, I don't see the need. --

[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-26 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- stage: - resolved ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24286 ___ ___

[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-26 Thread Roundup Robot
Roundup Robot added the comment: New changeset 9213c70c67d2 by Raymond Hettinger in branch '2.7': Issue #24286: Register dict views with the MappingView ABCs. https://hg.python.org/cpython/rev/9213c70c67d2 -- nosy: +python-dev ___ Python tracker

[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-25 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24286 ___

[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-25 Thread Joshua Bronson
New submission from Joshua Bronson: Is it intentional that the second assertion in the following code fails? ``` from collections import OrderedDict d = dict(C='carbon') o = OrderedDict(d) assert d == o assert d.viewitems() == o.viewitems() ``` Since d == o, I'm surprised that d.viewitems()

[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: This looks like a bug in Python 2.7: # Python2.7 from collections import Set isinstance({1:2}.viewitems(), Set) False # Python3.5 from collections import Set isinstance({1:2}.items(), Set) True I think the dictitems object needs to be registered as a

[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: The fix looks something like this: diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py --- a/Lib/_abcoll.py +++ b/Lib/_abcoll.py @@ -473,6 +473,7 @@ for key in self._mapping: yield (key, self._mapping[key])

[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-25 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- keywords: +patch Added file: http://bugs.python.org/file39502/fix_view_registry.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24286

[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This question looks similar to: Should list compare equal to set when the items are equal? -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24286

[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-25 Thread Larry Hastings
Changes by Larry Hastings la...@hastings.org: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24286 ___ ___ Python-bugs-list