Skip to content
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

Possible documentation error: range function docstring at julia/base/range.jl #33798

Closed
david-vicente opened this issue Nov 8, 2019 · 5 comments · Fixed by #34475
Closed
Labels
domain:docs This change adds or pertains to documentation good first issue Indicates a good issue for first-time contributors to Julia kind:bug Indicates an unexpected problem or unintended behavior

Comments

@david-vicente
Copy link

The second paragraph states

If length and stop are provided and step is not, the step size will be computed
automatically such that there are length linearly spaced elements in the range (a LinRange).

but in this setting I get the following

julia> typeof(range(1, length=10,stop=100))
StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}

A StepRangeLen instead of a LinRange.

@stevengj stevengj added kind:bug Indicates an unexpected problem or unintended behavior domain:docs This change adds or pertains to documentation good first issue Indicates a good issue for first-time contributors to Julia labels Dec 21, 2019
@stevengj
Copy link
Member

Yes, I noticed this too. As far as I can tell, the range function never produces a LinRange anymore — it always produces a StepRange (when an integer or rational step is provided) or a StepRangeLen (when a length is provided, or a floating-point step).

@stevengj
Copy link
Member

stevengj commented Dec 21, 2019

Actually the range function does produce a LinRange for arguments that are not simple numeric types:

julia> range([1,2], [3,4], length=10)
10-element LinRange{Array{Int64,1}}:
 [1.0, 2.0],[1.22222, 2.22222],…,[2.77778, 3.77778],[3.0, 4.0]

cc @timholy, who implemented a lot of this stuff in #18777.

In any case, the range documentation needs updating.

@stevengj
Copy link
Member

cc @kshyatt who was the last person to touch the range docs in #28115.

@kamalojasv181
Copy link
Contributor

Hi I just created a PR. Kindly review it. #34467

@kamalojasv181
Copy link
Contributor

Revised PR #34475

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:docs This change adds or pertains to documentation good first issue Indicates a good issue for first-time contributors to Julia kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
3 participants