list IndexError

Steven Bethard steven.bethard at gmail.com
Thu Dec 23 11:15:37 EST 2004


Mike C. Fletcher wrote:
> Ah, my mistake, I missed the [:] after the source argument that was 
> taking a copy... which brings up the question, how many other people 
> would miss it?

Too many.  This is why I greatly prefer

    list(lst)

to

    lst[:]

It's also clearer to me.  Do I really want a "slice" of the list?  No, I 
want a list copy of the list...

Steve



More information about the Python-list mailing list