Re: list mutability

2008-02-18 Thread John Machin
On Feb 19, 5:09 am, gigs <[EMAIL PROTECTED]> wrote: > hi im having this code > > l = [1, 3, 5, 'D', 1, 2, 3, 4, 5, 6, 7, 'A', 'S', 9, 8, 7, 6, 5, 4, 3, 2, 1, > 0, 'A'] > > why i need to copy x list? can someone explain me. If i dont copy it i get > this > result: > >>> took_num_range(l) > [[1, 2

list mutability

2008-02-18 Thread gigs
hi im having this code l = [1, 3, 5, 'D', 1, 2, 3, 4, 5, 6, 7, 'A', 'S', 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 'A'] why i need to copy x list? can someone explain me. If i dont copy it i get this result: >>> took_num_range(l) [[1, 2, 3, 4, 5, 6, 7], [6, 5, 4, 3, 2, 1, 0], [6, 5, 4, 3, 2, 1, 0], [6, 5,