Created
July 28, 2015 08:24
-
-
Save anlutro/9353fb43ed3b3095f086 to your computer and use it in GitHub Desktop.
Apparently += is unsafe in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> l = [] | |
>>> l = l + 'foo' | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
TypeError: can only concatenate list (not "str") to list | |
>>> l += 'foo' | |
>>> l | |
['f', 'o', 'o'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment