Julia: Should readdlm("file.csv"; header=true) return (header, data) instead of (data, header)?

Created on 29 Dec 2017  路  9Comments  路  Source: JuliaLang/julia

I recently stumbled on the fact that readdlm("file.csv"; header=true) return its arguments as (data, headers) rather than (headers, data).

Despite knowing this I always write it the second way, since that mirrors the order in which they appear in the source file.

Are there reasons for the "out-of-order" return order? If not, I think it would be a usability win to align the arguments with the order of appearance in the source file.

good first issue help wanted stdlib

Most helpful comment

Maybe a bit late for opinions on this, but I actually find that (data, headers) is more logical than (headers,data). The reason is simply that headers is an optional argument so it naturally should come second on output.

All 9 comments

The small story about this is that the issue is coming from slack, a user posted it as a note and there where some thumbs up and no thumbs down. I would rather let some core developer discuss the consecuences (and tradeoffs) of a deprecation for 0.7 and a switch for 1.0 or for the next major api break.
I candidate myself to make a little survey (if needed) about user expectations for this choice.

Bump. The proposal here is to change the order of the two elements in the return tuple of readdlm, which would be a backwards-incompatible change if done post-1.0.

Since readdlm has been moved to the stdlib, technically it would be possible to change the order. Better do it before 1.0 if we want to, though.

Sure, we should go ahead and change this.

I agree with the change as such, but really this entire package should be deprecated in favor of e.g. CSV.jl, so it seems kind of unnecessary to make breaking changes to it.

Maybe a bit late for opinions on this, but I actually find that (data, headers) is more logical than (headers,data). The reason is simply that headers is an optional argument so it naturally should come second on output.

Hello, I'd like to help on this issue.
I already have some code but I was wondering, should I also change the tests to expect the output in the new format?

I already have some code but I was wondering, should I also change the tests to expect the output in the new format?

Yes, definitely.

Given that there is some controversy here, and that we might want to remove this anyway, triage thinks we might as well leave it alone.

Was this page helpful?
0 / 5 - 0 ratings