On Fri, Apr 1, 2011 at 6:17 PM, Noufal Ibrahim <nou...@gmail.com> wrote:
> Came across this at PyCon. Comments?
>
>>>> foo = (1,[2,3,4])
>>>> foo[1] += [6]
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> TypeError: 'tuple' object does not support item assignment
>>>> foo
> (1, [2, 3, 4, 6])

Even nicer this way -

>>> foo = (1, [2, 3, 4])
>>> foo[1].append(5)
>>> foo
(1, [2, 3, 4, 5])
>>> foo[1].append(6)
>>> foo
(1, [2, 3, 4, 5, 6])

Regards,
BG

-- 
Baishampayan Ghose
b.ghose at gmail.com
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to