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

>If you omit the first index, the slice goes to the beginning of the list. If you omit the second index, the slice goes to the end of the list.

Unless you use the stride (third argument to the slice, the part that defaults to 1). If that is negative, then everything goes the opposite way, as in foo[::-1], the reverse of foo).



Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: