4 ms·
I'm curious if you would also accept [i:i-2] as a an empty list, or in general anything where the right side is smaller than the left? If I am working with clo
by thomasahle 4y ago
I'm curious if you would also accept [i:i-2] as a an empty list, or in general anything where the right side is smaller than the left?
If I am working with closed ranges, [i:i-1] looks like the list [i, i-1]. Like [5:2] would be [5, 4, 3, 2].
With [b+1:c] I would feel like I needed to insert a check to ensure b+1 <= c. With the closed ranges the invariant "left is <= right" is maintained automatically. Though I guess it doesn't matter so much if you accept any list with left > right as the empty list.
The issues with compositionality become even more noticeable with floats. Then you would need [a:b] + [b + minimum_float : c], or something like that.