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

Do you often find a need to slice hardcoded numbers, however?

I find that the only hardcoded number I often need to slice or index is indeed the start, and most languages do offer something for that such as `slice[..i]` to slice from the start.



Well I was replying to the statement that the OP was saying indexing is less important and I find when dealing with slices it definitely is important (as can be seen in your example).

Generally, I agree with what someone else here stated, 1 or 0 based indexing is less important than open or closed interval. The discussion around these two is typically mixed because 1-indexing uses right-open interval while 0-based indexing uses right-closed.




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

Search: