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

Lists can't hold two of the same object

Yes, they can. Try it! The index method has extra arguments to let you specify a range of indexes in the list to search, so you can find multiple indexes that point to the same object (by picking a range that excludes indexes you've previously found).

Dicts return the key by default

Dicts don't have an index method; dict keys are not ordered.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: