Tuples and immutability
Mark H. Harris
harrismh777 at gmail.com
Sat Mar 1 21:28:21 EST 2014
On Saturday, March 1, 2014 8:04:32 PM UTC-6, Eric Jacoboni wrote:
>
>
> In fact, i think i'm gonna forget += on lists :)
hi Eric, well, that might be extreme, but you certainly want to avoid
trying to change an immutable. Something you might want to consider
is trying something like creating a new immutable. In the example we've
been looking at I think I would change the tuple list item with an append();
however, you might try building a new tuple instead of trying to change
an existing tuple item.
I must admit that I would never have found this bug myself, because I don't
try to change tuples (at all). Anyway, I'm glad you found it -- we all learn
and that's the good news.
Cheers
More information about the Python-list
mailing list