Change order of arguments in soundfile.write() #132
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We had some discussions in the past about argument ordering (#54, #78), but I don't think we really talked about the order of the filename and the array argument in
soundfile.write().I always thought it would make sense to write the array first and the filename later.
I would ask "What?" first, before I want to know "Where?".
It also makes some kind of sense if you think about the array as an "input" argument and the filename as an "output" argument. I'd normally mention the input arguments before the output arguments.
However, while I'm using the function, I come to think more and more that the order actually seems strange.
What bugged me in the beginning, is that the array and its sample rate (which belong together), are actually separated in the call (and the sample rate is obligatory!):
Then I looked around and found that it's actually quite common to mention the file name first, e.g.:
http://docs.scipy.org/doc/numpy/reference/generated/numpy.savetxt.html
http://docs.scipy.org/doc/numpy/reference/generated/numpy.save.html
http://docs.scipy.org/doc/scipy/reference/generated/scipy.io.wavfile.write.html#scipy.io.wavfile.write
http://docs.scipy.org/doc/scipy/reference/generated/scipy.io.savemat.html
http://docs.scipy.org/doc/scipy/reference/generated/scipy.io.mmwrite.html#scipy.io.mmwrite
I hereby suggest that we change the order to:
Apart from it being the way NumPy and SciPy do it, it would also be more consistent to (and compatible to)
soundfile.read(), where the array and the sample rate are returned right next to each other.Are there any counter-examples that mention the data to be saved before the file name?
Are there any other arguments?