-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add range(start, stop) and range(start, stop, length) #39228
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this simplifies both documentation and implementation. 👍
The CI error is:
Line 1632 in fc6d219
@test_throws ArgumentError range(1, 100) |
test/ranges.jl
Outdated
@test r === range( stop=last(r), length=length(r)) | ||
@test r === range(first(r), last(r)) | ||
# the next ones use ==, because it changes the eltype | ||
@test r == range(first(r), last(r), length(r)) | ||
@test r == range(start=first(r), stop=last(r), length=length(r)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@test r === range( stop=last(r), length=length(r)) | |
@test r === range(first(r), last(r)) | |
# the next ones use ==, because it changes the eltype | |
@test r == range(first(r), last(r), length(r)) | |
@test r == range(start=first(r), stop=last(r), length=length(r)) | |
@test r === range( stop=last(r), length=length(r)) | |
@test r === range( first(r), last(r) ) | |
# the next ones use ==, because it changes the eltype | |
@test r == range( first(r), last(r), length(r)) | |
@test r == range(start=first(r), stop=last(r), length=length(r)) |
@jw3126 did a nice job of lining up similar aspects from each line. Perhaps we should maintain that style.
While I am in favor of this, it is controversal: |
Yes, but it's been discussed recently. See #38750 (comment) |
I just noticed that the tests you wrote are in a testset titled "range(;kw...)" |
Thanks, I just removed the testset. |
Merge conflict due to #39283 |
* Add range(start, stop) and range(start, stop, length) Co-authored-by: Matt Bauman <mbauman@juliacomputing.com>
* Add range(start, stop) and range(start, stop, length) Co-authored-by: Matt Bauman <mbauman@juliacomputing.com>
* added comments and reference for zero-dimensional arrays * updated table entry for `range` to reflect JuliaLang#39228 * made spelling of "one-dimensional" etc. uniform throughout the documentation
Fix #38750
I implemented
range(start, stop)
as that seemed simpler to document and be more consistent with the main docs. I can leave it undefined as it was before if people prefer.