On 04/05/2014 11:53 PM, John Ladasky wrote:
I find this programming pattern to be useful... but can it cause problems?
No.

What kind of problems are you considering? It won't break Python. It's perfectly legal code.

The tuple c is still immutable, consisting of two specific objects, and (as always) without regard to the specifics or contents of those two objects.

Gary Herron



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.

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to