Just like below:

In [1]: a = ([], [])

In [2]: a[0].append(1)

In [3]: a
Out[3]: ([1], [])

In [4]: a[0] += [1]
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-ea29ca190a4d> in <module>()
----> 1 a[0] += [1]

TypeError: 'tuple' object does not support item assignment

In [5]: a
Out[5]: ([1, 1], [])

no problem, there is an exception. But a is still changed.

is this a bug, or could anyone explain it?

thanks.


-- 
Best regards.
/**********************************
google+: +liuerfire <http://gplus.to/onepiece> twitter:
@liuerfire<https://twitter.com/#!/liuerfire>
蛋疼不蛋疼的都可以试着点一下~^_^~ <http://db.tt/YGEdRM0>
***********************************/
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to