Comment on Python: copying a list the right wayComments−swanson14yThis technique is also useful for iterating over a list and conditionally removing items. If you don't slice it you are changing the list as your iterate over it and you get unexpected results (like skipping items).Or you could just use list comprehensions :)
Comments
This technique is also useful for iterating over a list and conditionally removing items. If you don't slice it you are changing the list as your iterate over it and you get unexpected results (like skipping items).
Or you could just use list comprehensions :)