[BangPypers] Nice "feature"

Navin Kabra navin.kabra at gmail.com
Fri Apr 1 14:55:03 CEST 2011


With Python 2.6.5 (on ubuntu) I get even more bizarre behavior:
>>> foo=(1,[2,3,4])
>>> foo[1]+=6
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'int' object is not iterable
>>> foo
(1, [8, 9, 10])




On Fri, Apr 1, 2011 at 6:17 PM, Noufal Ibrahim <noufal at 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])
> >>>
>
> --
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list