On Thu, Apr 5, 2012 at 8:34 AM, Miki Tebeka <miki.teb...@gmail.com> wrote: > Greetings, > > I'm going to give a "Python Gotcha's" talk at work. > If you have an interesting/common "Gotcha" (warts/dark corners ...) please > share. > > (Note that I want over http://wiki.python.org/moin/PythonWarts already).
Don't know if it's what's meant on that page by the += operator, but the weirdness with concatenating onto a list inside a tuple may merit a mention. >>> a=([1],) >>> a[0].append(2) # This is fine >>> a ([1, 2],) >>> a[0]+=[3] # This is not. Traceback (most recent call last): File "<pyshell#134>", line 1, in <module> a[0]+=[3] TypeError: 'tuple' object does not support item assignment >>> a ([1, 2, 3],) Throws exception, but still does append to the list. ChrisA -- http://mail.python.org/mailman/listinfo/python-list