Skip to content

Instantly share code, notes, and snippets.

@anlutro
Created July 28, 2015 08:24
Show Gist options
  • Save anlutro/9353fb43ed3b3095f086 to your computer and use it in GitHub Desktop.
Save anlutro/9353fb43ed3b3095f086 to your computer and use it in GitHub Desktop.
Apparently += is unsafe in python
>>> 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