Range's and the : notation are mentioned in passing in several spots in the documentation, but it doesn't seem there's any thorough presentation about them.
Compare Python's documentation Slicings in 6.3.3 of https://docs.python.org/3/reference/expressions.html#primaries and the discussion of : in sequences at https://docs.python.org/3/library/stdtypes.html#sequence-types-list-tuple-range and https://docs.python.org/3/library/functions.html#func-range
Also, x:y:z has step y in julia but z in python. Maybe julia should match python? The change would be bad for old code, but might prevent errors for people coming from python.
Possible topics:
Also, x:y:z has step y in julia but z in python. Maybe julia should match python? The change would be bad for old code, but might prevent errors for people coming from python.
Julia uses the MATLAB/Octave convention for range steps. So you have to pick which group of users have to adjust. Since the rest of our range syntax follows from MATLAB as well (end, one-based indexes (at least for normal everyday arrays)) this is unlikely to be changed.
I agree that's a good reason to leave it as from:step:end. You can also add R to the have to adjust group, since they have seq(from, end, step).
@tkelman thanks for the tag. I need to find out how to add them.
The main issue is the documentation.
Would you make a pull request? Other than that, it's unlikely to happen soon.
Ranges using DateTime are also undocumented. I'll note that they are rather special as the step is a different type:
julia> DateTime(2015):Dates.Day(1):DateTime(2016)
2015-01-01T00:00:00:1 day:2016-01-01T00:00:00
1帽
Most helpful comment
Julia uses the MATLAB/Octave convention for range steps. So you have to pick which group of users have to adjust. Since the rest of our range syntax follows from MATLAB as well (
end, one-based indexes (at least for normal everyday arrays)) this is unlikely to be changed.