[New-bugs-announce] [issue22779] deque in-place addition does not return NotImplemented when appropriate

Ethan Furman report at bugs.python.org
Fri Oct 31 23:14:36 CET 2014


New submission from Ethan Furman:

--> from collections import deque
--> d = deque()
--> d += 1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'int' object is not iterable

deque should be returning NotImplemented, which would generate a more appropriate error message:

TypeError: unsupported operand type(s) for -=: 'collections.deque' and 'int'

which is what happens with -=, *=, /=, |=, at which point I stopped testing.

----------
assignee: rhettinger
messages: 230397
nosy: ethan.furman, rhettinger
priority: low
severity: normal
stage: needs patch
status: open
title: deque in-place addition does not return NotImplemented when appropriate
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22779>
_______________________________________


More information about the New-bugs-announce mailing list