Dear Andrea Griffini, Thanks for explaning this tricky underneath stuff.
Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ Andrea Griffini wrote: > On Sun, 19 Jun 2005 22:25:13 -0500, Terry Hancock > <[EMAIL PROTECTED]> wrote: > > >> PS is there any difference between > >> t=t+[li] > >> t.append(li) > > > >No, but > > Yes, a big one. In the first you're creating a new list > and binding the name t to it, in the second you're extending > a list by adding one more element at the end. > To see the difference: > > >>> a = [1,2,3] > >>> b = a > >>> a = a + [4] > >>> print a > [1, 2, 3, 4] > >>> print b > [1, 2, 3] > >>> > >>> a = [1,2,3] > >>> b = a > >>> a.append(4) > >>> print a > [1, 2, 3, 4] > >>> print b > [1, 2, 3, 4] > >>> > > Andrea -- http://mail.python.org/mailman/listinfo/python-list