initialized list: strange behavior
Hi Python experts! Please explain this behavior: >>> nn=3*[[]] >>> nn [[], [], []] >>> mm=[[],[],[]] >>> mm [[], [], []] Up till now, 'mm' and 'nn' look the same, right? Nope! >>> mm[1].append(17) >>> mm [[], [17], []] >>> nn[1].append(17) >>> nn [[17], [17], [17]] ??? Python 2.5 Win XP Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: initialized list: strange behavior
The issue is exhausted in Python Library Reference, Chapter 3.6, so I should apologize for initial posting. All comments were helpful, though Arnaud and Steve are right that pass-by-anything is off the point. Thanks All! -- http://mail.python.org/mailman/listinfo/python-list