Mutable objects inside tuples - good or bad?
John Ladasky
john_ladasky at sbcglobal.net
Sun Apr 6 02:53:57 EDT 2014
I find this programming pattern to be useful... but can it cause problems?
Python 3.3.2+ (default, Feb 28 2014, 00:52:16)
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> a = [1,2,3]
>>> b = [4,5,6]
>>> c = (a,b)
>>> c
([1, 2, 3], [4, 5, 6])
>>> c[0][0] = 0
>>> c
([0, 2, 3], [4, 5, 6])
Comments appreciated.
More information about the Python-list
mailing list