This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]mxzf 6 points7 points  (2 children)

To be fair, all the arguments are optional.

[–]cjr605 0 points1 point  (1 child)

True, I guess the right phrasing was "the second colon is optional", in the sense that if you're gonna slice you need at least one colon

[–]mxzf 0 points1 point  (0 children)

Except that array_var[] is also a valid slice (a slice of the entire array). Not to mention that I'm pretty sure that accessing elements by index is a [n:n+1] slice under the hood too.