Raymond Hettinger added the comment: Here is what other mutable types do:
>>> s = [] >>> s.__iadd__(1) Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> s.__iadd__(1) TypeError: 'int' object is not iterable >>> s = set() >>> s.__ior__(1) NotImplemented >>> from collections import deque >>> s = deque() >>> s.__iadd__(1) Traceback (most recent call last): File "<pyshell#6>", line 1, in <module> s.__iadd__(1) TypeError: 'int' object is not iterable >>> from array import array >>> s = array('i') >>> s.__iadd__(1) Traceback (most recent call last): File "<pyshell#10>", line 1, in <module> s.__iadd__(1) TypeError: can only extend array with array (not "int") >>> s = bytearray() >>> s.__iadd__(1) Traceback (most recent call last): File "<pyshell#12>", line 1, in <module> s.__iadd__(1) TypeError: can't concat int to bytearray ---------- priority: normal -> low _______________________________________ 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