This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2014年10月31日 22:07 by ethan.furman, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg230396 - (view) | Author: Ethan Furman (ethan.furman) * (Python committer) | Date: 2014年10月31日 22:07 | |
--> 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" |
|||
| msg230401 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2014年10月31日 22:20 | |
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. |
|||
| msg230408 - (view) | Author: Ethan Furman (ethan.furman) * (Python committer) | Date: 2014年10月31日 22:43 | |
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 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:09 | admin | set | github: 66967 |
| 2014年10月31日 22:43:33 | ethan.furman | set | messages: + msg230408 |
| 2014年10月31日 22:20:20 | rhettinger | set | status: open -> closed nosy: + rhettinger messages: + msg230401 assignee: rhettinger resolution: not a bug |
| 2014年10月31日 22:07:49 | ethan.furman | create | |