I think you need to read a python intro to see the difference between mutable / immutable lists and similar. This is a python question, not really a Sage question.
John Cremona On 7 June 2013 09:24, B. Zhang <yangtz...@gmail.com> wrote: > Hi, > > How to explain the difference between these two similar functions ? > Thansk. > > ===== Test 1 ======== > F = [1,2,3] > def test1(F): > F[0] = 0 > F[1] = 0 > F[2] = 0 > print F > test1(F); F > [0, 0, 0] > [0, 0, 0] > > ======= Test 2 =========== > F = [1,2,3] > def test2(F): > F = [0,0,0] > test2(F); F > [0, 0, 0] > [1, 2, 3] > > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-support+unsubscr...@googlegroups.com. > To post to this group, send email to sage-support@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-support?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support?hl=en. For more options, visit https://groups.google.com/groups/opt_out.