Skip to content

Instantly share code, notes, and snippets.

@9seconds
Created December 11, 2013 18:35
Show Gist options
  • Save 9seconds/7915921 to your computer and use it in GitHub Desktop.
Save 9seconds/7915921 to your computer and use it in GitHub Desktop.
Python WTFs
>>> a = (1, [2, 3])
>>> a[1] += [4, 5]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'tuple' object does not support item assignment
>>> print a
(1, [2, 3, 4, 5])
>>>
>>> a = []
>>> b = a += [1]
File "<stdin>", line 1
b = a += [1]
^
SyntaxError: invalid syntax
>>> b = a.__iadd__([1])
>>> print b
[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment