-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
MAINT: Made iterable
return a boolean
#7202
Conversation
WTF, why do we have |
No idea. It's the first thing in It seems that the MO in this case would be deprecation? In that case, I can investigate whether the function can be eliminated from numpy internally. If so, it can be deleted completely instead of just prepending an underscore and reviving from |
In the meantime, I think this PR is still valid given the circumstances. |
Hah, yeah, check it out: 052a7b2. It would make sense to deprecate the public exposure, I guess. Not really the highest priority thing. Removing internal uses is likely to be trickier, and not sure it's worth bothering. |
b : {0, 1} | ||
Return 1 if the object has an iterator method or is a sequence, | ||
and 0 otherwise. | ||
b : {False, True} |
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.
nitpick: should be b : bool
5f2a5b6
to
ceb19b0
Compare
I added a |
You can't just deprecate a function used internally without making the tests start failing. Also the deprecation should probably get discussed on the mailing list, even if it is a silly function to be exporting in the first place. On further thought, honestly, I personally don't really have the attention to spend a lot of time worrying about this silly little |
ceb19b0
to
165db42
Compare
Let's just fix the function. Besides, I have a severe allergy to all the try .. except constructs. |
66d0a30
to
8181f69
Compare
Failures on Travis CI appear related to annoyances from |
8181f69
to
4576343
Compare
Looks like a rebase fixed it. |
I have made one more commit to cleanly deprecate the pubic function. This version does not introduce any additional |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
This is a very old function that has some limited internal use but | ||
should not be a part of the public API. It can still be accessed | ||
internally as `numpy.function_base._iterable`. |
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.
release notes are for public consumption, so shouldn't mention the internal API unless we want people to use it (which we don't)
LGTM modulo the one comment, but if deprecating we should email the list to check that no-one objects -- can you do that? |
74178ac
to
34e8f4b
Compare
Fixed and sent. |
thanks! can you post a link to the archives thread here so we can find it On Wed, Feb 10, 2016 at 7:10 PM, Mad Physicist notifications@github.com
Nathaniel J. Smith -- https://vorpus.org http://vorpus.org |
Sure, here is the original email in the archives: https://mail.scipy.org/pipermail/numpy-discussion/2016-February/074920.html |
Thanks! Now we wait a few days and see if anyone yells... (sorry for the On Wed, Feb 10, 2016 at 7:29 PM, Mad Physicist notifications@github.com
Nathaniel J. Smith -- https://vorpus.org http://vorpus.org |
No problem at all. This is my first real experience contributing to a major open source project. It has been great so far. I have been using numpy for a while now, and it is nice to see how it works on the inside as well as to make some contributions beyond bug reports. So far, everything has been quite sensible and I really appreciate how much time and effort is put into not breaking things for the end user. |
34e8f4b
to
4576343
Compare
Given how often this function appears to be used, I have reverted my last commit. It is a pity this was not caught earlier (by about ten years). The code that is in the PR now should be trivial to merge. |
Yeah, too bad. Thanks for your patience with all of this :-) |
MAINT: Made `iterable` return a boolean
Thanks. I've learned a lot with the little PRs I've been making. I appreciate the hands-on teaching you and the rest of the core developers have been doing. Now I think it's time for me to delve a little deeper into the real code and see what I can learn. |
iterable
innumpy/lib/function_base.py
currently returns an integer 0 or 1. There is no reason not to return the more PythonicTrue
orFalse
. All usages withinnumpy
are in statements of the formif itrerable(...):
andif not iterable(...):
. Backwards compatibility outsidenumpy
will not be broken sinceTrue==1
andFalse==0
.