Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
swanson
on Nov 6, 2011
|
parent
|
context
|
favorite
| on:
Python: copying a list the right way
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 :)
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
Or you could just use list comprehensions :)