Message230389
| Author |
rhettinger |
| Recipients |
Joshua.Chin, ethan.furman, pitrou, r.david.murray, rhettinger |
| Date |
2014年10月31日.21:12:48 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1414789968.36.0.504210271299.issue22766@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 |
|