[issue22766] collections.Counter's in-place operators should return NotImplemented for unsupported types
Raymond Hettinger
report at bugs.python.org
Fri Oct 31 23:18:47 CET 2014
Raymond Hettinger added the comment:
Note, the += operation is conceptually similar to update() methods with are usually duck typeable:
>>> d = {}
>>> d.update(1)
Traceback (most recent call last):
File "<pyshell#16>", line 1, in <module>
d.update(1)
TypeError: 'int' object is not iterable
>>> s = set()
>>> s.update(1)
Traceback (most recent call last):
File "<pyshell#18>", line 1, in <module>
s.update(1)
TypeError: 'int' object is not iterable
>>> dict(1)
Traceback (most recent call last):
File "<pyshell#19>", line 1, in <module>
dict(1)
TypeError: 'int' object is not iterable
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22766>
_______________________________________
More information about the Python-bugs-list
mailing list