Julia: Linspace defaults the `n` parameter to 50

Created on 26 Nov 2017  Â·  6Comments  Â·  Source: JuliaLang/julia

I was surprised when I found that Julia's linspace function uses the number 50 as the default argument for the number of steps:

linspace(start, stop, n=50)

Discussion on Slack indicated that this behavior comes from SciPy, but that it should probably be dropped for 0.7.

Most helpful comment

No default makes sense for this function IMHO.

All 6 comments

Agreed; that seems like a pretty arbitrary default value.

What would be a better default value? Or is the idea that we shouldn't have a default value at all?

No default makes sense for this function IMHO.

btw: on matlab 100

@yurivish, let me know if you intend to submit a PR, otherwise I will do it.

Relatedly, logspace has a default base of 10. I'm inclined to say it's fine to keep this.

@timholy submitted: https://github.com/JuliaLang/julia/pull/24805

I noticed that logspace also had the default value 50 for its n argument so I changed that in the above PR, for the same reasons we decided to remove it from linspace.

Unrelatedly, I noticed that the actual parameter for linspace is called len in the code, though it's n in the docs — should I file a separate PR for that? I'd guess len is the more descriptive name.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iamed2 picture iamed2  Â·  3Comments

omus picture omus  Â·  3Comments

ararslan picture ararslan  Â·  3Comments

TotalVerb picture TotalVerb  Â·  3Comments

tkoolen picture tkoolen  Â·  3Comments