Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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: