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 2011年06月11日 22:02 by gruszczy, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg138185 - (view) | Author: Filip Gruszczyński (gruszczy) | Date: 2011年06月11日 22:02 | |
You can do this: >>> [1] + (1,) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: can only concatenate list (not "tuple") to list But you can do this: >>> result = [1] >>> result += (1,) >>> result [1, 1] Is it the expected behaviour, that += does implicit coercion? |
|||
| msg138186 - (view) | Author: Filip Gruszczyński (gruszczy) | Date: 2011年06月11日 22:03 | |
Obviously first sentence should be "You can't do this:". |
|||
| msg138188 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2011年06月11日 22:49 | |
Yes, this is the expected behavior and yes, it is inconsistent. It's been that way for a long while and Guido said he wouldn't do it again (it's in his list of regrets). However, we're not going to break code by changing it (list.__iadd__ working like list.extend). |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:18 | admin | set | github: 56527 |
| 2011年06月11日 22:49:21 | rhettinger | set | status: open -> closed nosy: + rhettinger messages: + msg138188 resolution: not a bug |
| 2011年06月11日 22:03:24 | gruszczy | set | messages: + msg138186 |
| 2011年06月11日 22:02:51 | gruszczy | create | |