By the way, I would find it more intuitive if the `stop` boundary
was included in the interval, i.e. `int[0:10]` means all the
integer numbers from 0 to 10 (including 10). I don't think that
conflicts with the current notion of slices since they always
indicate a position in the sequence, not the values directly (then
`int[0:10]` would mean "the first 10 integer numbers", but where
do they even start?).
It's always interesting how people's intuitions can differ. Making the stop value inclusive by default is a little jarring to me since it is so inconsistent with sequence indexing elsewhere. But I do see your point that in reality this is NOT slicing positions in a sequence (since it has no beginning and end). I don't think it would be a terrible thing for both start and stop to be inclusive by default.
But regardless of whether the stop value is inclusive or not, there are certainly going to be instances when someone will want inclusivity and others when they want exclusivity, and this applies to both the start and the stop value.
In other words, any syntax that did not provide the ability to state all of these number lines would seem pretty wanting:
0 < x < ∞ # all positive integers
-∞ < x < 0 # all negative integers
0.0 < x < ∞ # all positive floats
-∞ < x < 0.0 # all negative floats
0 <= x < ∞ # all positive integers, zero included
-∞ < x <= 0 # all negative integers, zero included
0.0 <= x < ∞ # all positive floats, zero included
-∞ < x <= 0.0 # all negative floats, zero included
0 <= x <= 10 # some inclusive int interval
0 < x < 10 # some exclusive int interval
0 < x <= 10 # some int interval, combined boundaries
0 <= x < 10 # some int interval, combined boundaries
0.0 <= x <= 10.0 # some inclusive float interval
0.0 < x < 10.0 # some exclusive float interval
0.0 < x <= 10.0 # some float interval, combined boundaries
0.0 <= x < 10.0 # some float interval, combined boundaries
And versions of all of these with step arguments.
A way around the inclusive vs exclusive problem might be to define some sort of indicator, or function, to modify the boundaries.
Here's several ideas of how to spell the number line 0 < x <=10:
>>> x: int[excv(0):incv(10)] # where incv and excv stand for "inclusive" and "exclusive"
>>> x: int[@0:10] # where the @ is read "almost" or "about" or "around" -- the idea is all boundaries are inclusive by default and the @ makes a boundary exclusive
>>> x: int[(0,"incv"):(10,"excv")] # here we just pass tuples to the start and stop slice arguments, and the text indicates whether each boundary is inclusive (incv) or exclusive (excv)
I think the third is my favorite - it reads pretty nicely. Although it would be nicer if it didn't need the parentheses. The second one is interesting though.
But of course regardless of which of these spellings (or some other) is preferred, the default behavior would still need to be defined.