Love L.itemgot
… so useful.
What I’m looking for is a version that operates on a slice, something like … L.itemgot(2:)
where it would return all the items of index 2 until the end in a new L
.
Is there something like that already in L
?
Love L.itemgot
… so useful.
What I’m looking for is a version that operates on a slice, something like … L.itemgot(2:)
where it would return all the items of index 2 until the end in a new L
.
Is there something like that already in L
?
It can take several indices, but not a slice AFAICT
Python itself doesn’t support that notation, unfortunately.
I tried that and got unexpected results …
x = L((1,2,3), (10,100,1000))
x.itemgot(0)
# (#2) [1,10]
x.itemgot(1)
# (#2) [2,100]
x.itemgot(0,1)
# throws exception .... TypeError: 'int' object is not subscriptable
What I was expecting was something like …
# (1,10),(2,100)