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 Winter 2027 batch! Applications are open till November 2.

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

Search: