Repository navigation
Conversation
|
Hmmm, I am a bit worried how this will turn out with gh-24224 (although I missed the typing changes there). |
@seberg In this PR I just renamed |
|
True, just going to have to touch a lot of this twice, made me wonder if it really is so bad to have |
8ff7807 to
eb525b5
Compare
|
All downstream libs PRs have been merged. |
eb525b5 to
ed36420
Compare
ngoldbaum
left a comment
There was a problem hiding this comment.
LGTM! In the interest of avoiding breaking downstream CI on a Friday I'd like to merge this early next week.
|
This seems pretty disruptive to me; when deprecating something in numpy, usually there is a replacement that already exists; but in this case, Maybe that's fine here due to this targeting 2.0, and so the normal approach of |
| A mypy_ plugin is now available for automatically assigning the (platform-dependent) | ||
| precisions of certain `~numpy.number` subclasses, including the likes of | ||
| `~numpy.int_`, `~numpy.intp` and `~numpy.longlong`. See the documentation on | ||
| `~numpy.long`, `~numpy.intp` and `~numpy.longlong`. See the documentation on |
There was a problem hiding this comment.
I think this is misleading, as in 1.21 np.long meant something different.
There was a problem hiding this comment.
Ah right, I added this change by accident. Reverted!
| @@ -0,0 +1,3 @@ | |||
| * ``np.int_`` has been deprecated. Use ``np.long`` instead. | |||
There was a problem hiding this comment.
| * ``np.int_`` has been deprecated. Use ``np.long`` instead. | |
| * ``np.int_`` as the spelling of C's `long` has been deprecated. Use the new ``np.long`` instead. |
I had envisioned something like: Or equivalently something that switches on numpy version. I'd be fine with leaving behind an |
|
The other relevant argument is that 8 or 9 out of 10 times, the use of |
|
I missed earlier - this needs an update to the migration guide I think. In the vein of Ralf's comment, the release note, migration guide, and maybe the error message should probably indicate that another possible replacement is to use the python |
I don't think this is a good idea if we're planning to change the meaning of |
Good point, I agree. I didn't consider that we'd want to do this in the future, but it does seem like a logical change to make. |
|
The only way I can think of it is that So that doesn't actually fix the problem because even if you keep Now I don't care too much about what happens with |
|
Just FYI, this comment (scipy/scipy#19310 (comment)) shows the source where |
|
My appetite for removing Yes, there are a few places where So the point remains: If this nudges even a fraction of users to using |
|
In that case would you be ok with restoring np.float_ and np.complex_ to keep the API consistent? |
Whether we remove |
I don't really care either way (so yes, I am OK with it). Those don't have the confusion about what is the default. I mainly dislike that it seems to become quite hard to spell "default integer" and that seems to lead to confusion where we replace |
It depends on what that means, but as a concept this is not well-defined in NumPy, while in the Array API standard it is (and it should be Even on 32-bit systems, the "default integer" should be The way I see it, we should recommend users to use the following:
These are not useful, so let's please not restore them. They're only counterproductive. |
|
We can perhaps postpone removal of |
Sure it is! We've talked about Numeric/numarray/numpy having default integer and floating point types since the beginning. Essentially, the default integer type is whatever dtype |
You're right, thanks for the correction - it exists indeed, it just isn't very clearly documented (but that's true for other things as well). |
|
Let's split out the "what should the default be" to gh-24890. I thought since nobody has really disagreed said something else the many times I have said "intp seems the pragmatic choice to do something here", I thought that was consensus. |
|
We ended up landing at the last community meeting that the most sensible thing might be to close this PR, leave In principle we could replace I think reintroducing |
|
Hmmm, yeah, it would probably be good to split out adding long (and maybe tests) from my PR to help move it along. |
|
@seberg Sure! I will make a separate |
Addresses #24743.
This PR deprecates
np.int_withnp.uint, and restoresnp.longwithnp.ulong.