We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
GitHub fields:
assignee = 'https://github.com/rhettinger' closed_at = <Date 2014-10-31.22:20:20.183> created_at = <Date 2014-10-31.22:07:49.806> labels = ['type-bug', 'invalid'] title = "list's in-place add doesn't return NotImplemented when appropriate" updated_at = <Date 2014-10-31.22:43:33.995> user = 'https://github.com/ethanfurman'
bugs.python.org fields:
activity = <Date 2014-10-31.22:43:33.995> actor = 'ethan.furman' assignee = 'rhettinger' closed = True closed_date = <Date 2014-10-31.22:20:20.183> closer = 'rhettinger' components = [] creation = <Date 2014-10-31.22:07:49.806> creator = 'ethan.furman' dependencies = [] files = [] hgrepos = [] issue_num = 22778 keywords = [] message_count = 3.0 messages = ['230396', '230401', '230408'] nosy_count = 2.0 nosy_names = ['rhettinger', 'ethan.furman'] pr_nums = [] priority = 'normal' resolution = 'not a bug' stage = None status = 'closed' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue22778' versions = ['Python 3.5']
The text was updated successfully, but these errors were encountered:
--> s = [] --> s += 1 Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'int' object is not iterable
For comparison, when NotImplemented is appropriately returned the message looks like this:
--> s -= 1 Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for -=: 'list' and 'int'
Which is certainly more helpful than "<blank> object is not iterable"
Sorry, something went wrong.
Please don't replicate existing issues.
Also, this behavior for lists is long-standing, tested, and designed by Guido. More than a little code relies on this behavior.
My understanding was that if a different patch will be needed, it is not the same issue. Is that not correct?
Here's the test:
def test_iadd(self): ... self.assertRaises(TypeError, u.__iadd__, None)
It would still pass, as returning NotImplemented will still result in a TypeError, just with a friendlier message.
If any code is depending on this, it is depending on the error message text, which is explicitly not guaranteed
rhettinger
No branches or pull requests
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: