-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
[WIP] MAINT: get rid of np.int #5032
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
np.int is a confusing synonym for __builtin__.int; it maps to C long, the size of which is platform-dependent. The NumPy devs are speaking of deprecating np.int, and all uses of it in SciPy have been replaced. Notably, this makes sample_without_replacement 64-bit clean; previously it used np.int_t, which is a C long (32 bits wide on Windows). See also http://github.com/numpy/numpy#6103.
Is |
Are you referring to a specific part of the PR, or in general? |
In general. Or |
For indices, |
I think we removed all appearances of float in favour of float64. |
I am also wondering why not |
$ git grep 'np\.float[^0-9]' -- '*.py' | wc -l
111 |
meh. Ok. maybe not. but that is just a single command to fix ;) |
the question is whether we want to use numpy types or python types, right? |
I'm in favor of using |
It's a bit hard to know whether something will be used as index, right? I guess we don't generally pass integers around, though, apart from the cross-validation module, where they will be used as indices. |
samples_range = np.linspace(2, 1000, 4).astype(np.int) | ||
features_range = np.linspace(2, 1000, 4).astype(np.int) | ||
samples_range = np.linspace(2, 1000, 4).astype(int) | ||
features_range = np.linspace(2, 1000, 4).astype(int) |
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.
These should all be linspace(..., dtype=int)
to avoid a copy
too many conflicts. If we want to do this we should start from scratch. |
np.int
is a confusing synonym for__builtin__.int
; it maps to Clong
, the size of which is platform-dependent and not necessarily the same as that of Cint
. The NumPy devs are speaking of deprecatingnp.int
, and all uses of it in SciPy have just been removed (scipy/scipy@10ca036).Don't merge yet: these are not all occurrences, and
np.float
needs the same treatment.See also numpy/numpy#6103.