Message230389
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 |
|
Date |
User |
Action |
Args |
2014-10-31 21:12:48 | rhettinger | set | recipients:
+ rhettinger, pitrou, r.david.murray, ethan.furman, Joshua.Chin |
2014-10-31 21:12:48 | rhettinger | set | messageid: <1414789968.36.0.504210271299.issue22766@psf.upfronthosting.co.za> |
2014-10-31 21:12:48 | rhettinger | link | issue22766 messages |
2014-10-31 21:12:48 | rhettinger | create | |
|