-
-
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
Linspace without endpoints #27097
Comments
As one of the examples in that thread showed, the easier/safer workaround here is: range(a, stop=b, length=N+2)[2:end-1] I still think I prefer that over another keyword argument. |
Is there any performance degradation for having one more keyword? If that is not the case, I can't see what is the problem with having an extra keyword (from an users perspective). Isn't it true that we can just forget about that keyword when it is not needed? My idea is something like |
All API surface costs in maintenance, documentation and complexity. This is really easy to accomplish with slicing. |
It would be very useful to have a variant of linspace that does not hit its endpoints: linspace(a,b,endpoint=false) rather than a:(b-a)/N:b-(b-a)/N and having to worry about reading it later, getting the math wrong, round-off errors maybe not giving me exactly N points, and evaluating a and b more than once. A typical use-case is representing periodic signals. Bonus points for inclusion/exclusion of left, right and both endpoints. With the new
range
-based linspace (#25896) the API would be a bit more awkward, but still worth it I think.Requested for instance here https://discourse.julialang.org/t/proposal-of-numpy-like-endpoint-option-for-linspace/6916
The text was updated successfully, but these errors were encountered: