Lists: why is this behavior different for index and slice assignments?

Duncan Booth duncan.booth at invalid.invalid
Tue Apr 22 13:45:45 EDT 2008


Steve Holden <steve at holdenweb.com> wrote:

> Assignment to a list *element* rebinds the single element to the 
> assigned value. Assignment to a list *slice* has to be of a list, and it 
> replaces the elements in the slice by assigned elements.
> 
Assignment to a list *slice* just has use an iterable, it doesn't actually 
have to be another list.



More information about the Python-list mailing list