Hacker News new | past | comments | ask | show | jobs | submit login

Negative indexing (along with the related syntax for slicing) is one of the most usefull python features. Numpy and pandas thrive on it.

Just learn the language, python is already one of the easiest languages out there.




I know python. I have rarely found negative indices useful except to pick out the last item of a list, and I've done a decent amount of it, though no numpy/pandas yet. In what way is negative indices particularly useful for these latter two?

I have no problem with slicing. You can't get it accidentally wrong because the syntax is visible. Negative indexing vs positive indexing can't generally be distinguished just by looking at the indexing statement, which is where I tripped up.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: