New submission from Joshua Chin: Currently, in-place operations on 'collections.Counter' with unsupported types raises an 'AttributeError'.
Example: >>> import collections >>> counter = collections.Counter() >>> counter += 1 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/collections/__init__.py", line 709, in __iadd__ for elem, count in other.items(): AttributeError: 'int' object has no attribute 'items' Instead, it should return 'NotImplemented' if 'other' is not a 'collections.Counter' ---------- components: Library (Lib) files: counter.patch keywords: patch messages: 230271 nosy: Joshua.Chin priority: normal severity: normal status: open title: collections.Counter's in-place operators should return NotImplemented for unsupported types type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file37075/counter.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22766> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com