[英]Why isn't __add__ implemented in Python's deque?
Concatenating two deque
s results in a TypeError
. 连接两个deque
导致TypeError
。
from collections import deque
q = deque()
q + q
But __iadd__
is implemented so +=
is supported. 但__iadd__
已实现,因此支持+=
。
q1 = deque([1])
q2 = deque([2])
q1 += q2
What is the reason that only __iadd__
get implemented? 只有__iadd__
被实现的原因是什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.