On Tue, May 06, 2014 at 06:36:21PM +0100, Alan Gauld wrote:

> Aside:
> len() does work with range() and slicing so you can write
> 
> myList[:len(mylist)]
> 
> to get a copy of your list...

Even easier is a blank slice. The start defaults to zero, the 
end to the length of the sequence, and the step to 1, so to make a copy 
of a list is:

myList[:]  # start=0, end=length

or 

myList[::]  # start=0, end=length, step=1


-- 
Steven
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to