-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
MAINT: Remove the unused keepdim argument from np.ufunc.accumulate #8187
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
Conversation
numpy/core/src/umath/ufunc_object.c
Outdated
static char *kwlist2[] = {"array", "indices", "axis", | ||
"dtype", "out", NULL}; | ||
static char *reduce_kwlist[] = { | ||
"array", "axis", "dtype", "out", "keepdims", NULL}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Umm, looks like you may have a hard tab in here. I preferred to previous format to tell the truth, although the alignment was a bit off on the second line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a set of spaces to align columns, to make visually diffing the arg lists easier.
The previous format was just indented with a bunch of soft tabs until it roughly aligned. I definitely think that having all the list items on one line is an improvement, but could be persuaded to remove that alignment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Big no-no. The way it was before was correct, and quite standard for C code, just off by a single space. See the doc/C_STYLE_GUIDE.rst.txt
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, and no hard tabs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading that guide, the only mistake I seem to have made is indenting the wrapped line by one "tab" and not two. I don't see anything saying that if a line is wrapped, the first line should be made as long as possible. Which bit specifically are you calling a "no-no"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple spaces after the ,
. It looks just awful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'd argue that that the alignment of argument names isn't worth the extra spacing then? Happy to remove if so, although I think having it on one line is still desirable. I've added the second "tab" of indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes ;) I understand the temptation, but it is a false god. Along the same lines, PEP8 disapproves of aligning on equals signs, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be some exceptions for tabular test data, where having data aligned in columns may be useful, but here is is just a distraction to (my) eye.
numpy/add_newdocs.py
Outdated
@@ -5919,6 +5919,13 @@ def luf(lamdaexpr, *args, **kwargs): | |||
First array | |||
B : array_like | |||
Second array | |||
dtype : data-type code, optional | |||
The type used to represent the intermediate results. Defaults |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is correct. I believe what happens is that the arrays are converted to the common type, or dtype if given, the operation done, and then converted to the out
type if the out
argument is given.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can check that that is the case by using various combinations of dtype and out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, blindly copied from another ufunc method, without thinking hard enough about whether it applied
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally missed the mark with this one - the arguments are just forwarded to the ufunc, including things like where
which don't have all too sensible a result
Couple of style nits and probably the documentation is incorrect. The actual change looks OK. |
82a9c67
to
93fa698
Compare
Ok, should be good for another review |
93fa698
to
aedccb7
Compare
OK, this looks good. However, current uses of The temptation is to skip this process as it seems unlikely that the keyword is actually used by anyone, but it is best to follow procedure. |
I apologize for not noticing the problem earlier, it just slipped my mind. |
aedccb7
to
ee85ecc
Compare
ee85ecc
to
a77d0e0
Compare
Ok, broken into three PRs:
|
a77d0e0
to
d15c75d
Compare
Ok, this one is all set for 1.14 |
OK, thanks. |
☔ The latest upstream changes (presumably #8302) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #9062) made this pull request unmergeable. Please resolve the merge conflicts. |
d4ea692
to
f44ef18
Compare
Rebased |
This would seem OK to merge now, so I'll go ahead and do that. Nice to get the code cleaner, even if it is by a little bit at the time! |
No description provided.