62
slicing arrays (hexbear.net)
submitted 4 months ago by Owl@hexbear.net to c/technology@hexbear.net
you are viewing a single comment's thread
view the rest of the comments
[-] invalidusernamelol@hexbear.net 1 points 4 months ago* (last edited 4 months ago)

You're right, it would return a list containing the first element of the sliced list.

So:

lst[:3:3] == [lst[0]]

Well, technically a sequence containing the first element of whatever sequence you sliced. Take advantage of implementing magic methods and you too can abuse slice notation with your classes.

this post was submitted on 13 Jul 2024
62 points (98.4% liked)

technology

23313 readers
151 users here now

On the road to fully automated luxury gay space communism.

Spreading Linux propaganda since 2020

Rules:

founded 4 years ago
MODERATORS