问题
Concatenating two deques results in a TypeError.
from collections import deque
q = deque()
q + q
But __iadd__ is implemented so += is supported.
q1 = deque([1])
q2 = deque([2])
q1 += q2
What is the reason that only __iadd__ get implemented?
回答1:
This is a bug which is already fixed in the repos, so it should be included in the next released version of Python (3.5).
来源:https://stackoverflow.com/questions/32547316/why-isnt-add-implemented-in-pythons-deque