Am Mittwoch 17 Mai 2006 17:06 schrieb [EMAIL PROTECTED]: > Maybe I'm missing something but the latter is not the behaviour I'm > > expecting: > >>> a = [[1,2,3,4], [5,6,7,8]] > >>> b = a[:] > >>> b > > [[1, 2, 3, 4], [5, 6, 7, 8]] > > >>> a == b > > True > > >>> a is b > > False >
Try an: >>> a[0] is b[0] and >>> a[1] is b[1] here, and you'll see, that [:] only creates a shallow copy. Thus, the lists in the lists aren't copied, they are shared by the distinct lists a and b. Hope this clears it up. --- Heiko. -- http://mail.python.org/mailman/listinfo/python-list