Re: [Numpydiscussion] fromnumeric.py internal calls
Hello all, I have PR #7325 <https://github.com/numpy/numpy/pull/7325/files> up that changes the internal calls for functions in *fromnumeric.py* from positional arguments to keyword arguments. I made this change for two reasons: 1) It is consistent with the external function signature 2) The inconsistency caused a breakage in *pandas* in its own implementation of *searchsorted* in which the *sorter* argument is not really used but is accepted so as to make it easier for *numpy* users who may be used to the *searchsorted* signature in *numpy*. The standard in *pandas* is to "swallow" those unused arguments into a *kwargs* argument so that we don't have to document an argument that we don't really use. However, that turned out not to be possible when *searchsorted* is called from the *numpy* library. Does anyone have any objections to the changes I made? Thanks! Greg
I think this is an improvement, but I do wonder if there are libraries out there that use *args instead of **kwargs to handle these extra arguments. Perhaps it's worth testing this change against third party array libraries that implement their own array like classes? Off the top of my head, maybe scipy, pandas, dask, astropy, pint, xarray? On Wed, Feb 24, 2016 at 3:40 AM G Young <gfyoung17@gmail.com> wrote:
Hello all,
I have PR #7325 <https://github.com/numpy/numpy/pull/7325/files> up that changes the internal calls for functions in *fromnumeric.py* from positional arguments to keyword arguments. I made this change for two reasons:
1) It is consistent with the external function signature 2)
The inconsistency caused a breakage in *pandas* in its own implementation of *searchsorted* in which the *sorter* argument is not really used but is accepted so as to make it easier for *numpy* users who may be used to the *searchsorted* signature in *numpy*.
The standard in *pandas* is to "swallow" those unused arguments into a *kwargs* argument so that we don't have to document an argument that we don't really use. However, that turned out not to be possible when *searchsorted* is called from the *numpy* library.
Does anyone have any objections to the changes I made?
Thanks!
Greg _______________________________________________ NumPyDiscussion mailing list NumPyDiscussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpydiscussion
Well I know pandas uses **kwargs (that was the motivation for this PR), but I can certainly have a look at those other ones. I am not too familiar with all of the third party libraries that implement their own arraylike classes, so if there any others that come to mind, let me know! Also, could you also add that as a comment to the PR as well? Thanks! On Mon, Feb 29, 2016 at 7:44 AM, Stephan Hoyer <shoyer@gmail.com> wrote:
I think this is an improvement, but I do wonder if there are libraries out there that use *args instead of **kwargs to handle these extra arguments. Perhaps it's worth testing this change against third party array libraries that implement their own array like classes? Off the top of my head, maybe scipy, pandas, dask, astropy, pint, xarray? On Wed, Feb 24, 2016 at 3:40 AM G Young <gfyoung17@gmail.com> wrote:
Hello all,
I have PR #7325 <https://github.com/numpy/numpy/pull/7325/files> up that changes the internal calls for functions in *fromnumeric.py* from positional arguments to keyword arguments. I made this change for two reasons:
1) It is consistent with the external function signature 2)
The inconsistency caused a breakage in *pandas* in its own implementation of *searchsorted* in which the *sorter* argument is not really used but is accepted so as to make it easier for *numpy* users who may be used to the *searchsorted* signature in *numpy*.
The standard in *pandas* is to "swallow" those unused arguments into a *kwargs* argument so that we don't have to document an argument that we don't really use. However, that turned out not to be possible when *searchsorted* is called from the *numpy* library.
Does anyone have any objections to the changes I made?
Thanks!
Greg _______________________________________________ NumPyDiscussion mailing list NumPyDiscussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpydiscussion
_______________________________________________ NumPyDiscussion mailing list NumPyDiscussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpydiscussion
participants (2)

G Young

Stephan Hoyer