Why is __add__ not implemented in Python deque?

Combining the two dequeleads to TypeError.

from collections import deque
q = deque()
q + q

But __iadd__implemented, therefore supported +=.

q1 = deque([1])
q2 = deque([2])
q1 += q2

What is the reason for the implementation __iadd__?

+4
source share
1 answer

This is a bug that has already been fixed in the repositories, so it should be included in the next released version of Python (3.5).

+3
source

Source: https://habr.com/ru/post/1607139/


All Articles