-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed interval maybe a mistake? #314
Comments
I'm afraid it would be a huge breaking change. What about the math version: The other option would be to use the Python equivalent |
Indeed, and I find some interesting uses of range: > [1, 2, 3, 4][0 .. -1]
[1, 2, 3, 4]
> [1, 2, 3, 4][0 .. 0] # not an empty range
[1]
> [1, 2, 3, 4][0 .. -4]
[1]
> [1, 2, 3, 4][0 .. -5]
[] |
You could also use Ruby syntax by adding another dot, but i can see how that would be confusing. > [0..5]
[0,1,2,3,4,5]
> [0...5]
[0,1,2,3,4] Another idea is having > [0..=5]
[0,1,2,3,4,5]
> [0..<5]
[0,1,2,3,4] |
I agree with this. |
Revisiting some old issues. Are you still in favor of this syntax for excluded last value? |
I'm just a casual observer who thinks Berry is really neat, but IMHO Python's |
This may be possible. Considering: # if operator : has the following rules:
a : b # => range(a, b) if `a`, `b` is integer
a : b # => range(a.lower(), a.upper(), b) if `a` is a range, then update its step!
# examples:
1 : 10 : 2 # => range(1, 10, 2) |
It doesn't seem like a big deal? |
In my current experience, the expression$[a, b)$ might be better?
0..5
means that[0,1,2,3,4,5]
doesn't seem to work as well as[0,1,2,3,4]
, so the half-closed intervalThe text was updated successfully, but these errors were encountered: