List.Slice


#1

I was looing at this node but something just doesn’t seem right to me. It is consistently dropping the value in the last “block” as you can see in the images below. Am I just misunderstanding how this is supposed to work? Why would it drop the last value, especially when the Step is set to 1? Do you think this is a bug? Thanks.

listslice1listslice2


#2

This can only be explained if one assumed that this node is based on something called RANGE. In programming languages like Python or VB when Range() is called it works like this: range(0,10,1) where 0 is start, 10 is end and 1 is step. Here is what such range returns though: [0,1,2,3,4,5,6,7,8,9] and as you can see it doesnt actually include the end item. This is normal behavior and its quite common to do this: range(0,10+1,1) and that will return something that you desire which is a range of numbers including the end statement [0,1,2,3,4,5,6,7,8,9,10].


#3

Thanks Konrad, weird, but if it works consistently that way, I’ll adjust my thinking :slight_smile: