<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Dec 6, 2020 at 4:23 PM Sebastian Berg <<a href="mailto:sebastian@sipsolutions.net">sebastian@sipsolutions.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sat, 2020-12-05 at 20:12 -0700, Charles R Harris wrote:<br>
> On Sat, Dec 5, 2020 at 4:31 PM Juan Nunez-Iglesias <<a href="mailto:jni@fastmail.com" target="_blank">jni@fastmail.com</a>><br>
> wrote:<br>
> <br>
> > Hi all,<br>
> > <br>
> > At the prodding [1] of Sebastian, I’m starting a discussion on the<br>
> > decision to deprecate np.{bool,float,int}. This deprecation broke<br>
> > our<br>
> > prerelease testing in scikit-image (which, hooray for rcs!), and<br>
> > resulted<br>
> > in a large amount of code churn to fix [2].<br>
> > <br>
> > To be honest, I do think *some* sort of deprecation is needed,<br>
> > because for<br>
> > the longest time I thought that np.float was what np.float_<br>
> > actually is. I<br>
> > think it would be worthwhile to move to *that*, though it’s an even<br>
> > more<br>
> > invasive deprecation than the currently proposed one. Writing `x =<br>
> > np.zeros(5, dtype=int)` is somewhat magical, because someone with a<br>
> > strict<br>
> > typing mindset (there’s an increasing number!) might expect that<br>
> > this is an<br>
> > array of pointers to Python ints. This is why I’ve always preferred<br>
> > to<br>
> > write `dtype=<a href="http://np.int" rel="noreferrer" target="_blank">np.int</a>`, resulting in the current code churn.<br>
> > <br>
> > I don’t know what the best answer is, just sparking the discussion<br>
> > Sebastian wants to see. ;) For skimage we’ve already merged a fix<br>
> > (even if<br>
> > it is one of dubious quality, as Stéfan points out [3] ;), so I<br>
> > don’t have<br>
> > too much stake in the outcome.<br>
> > <br>
> > Juan.<br>
> > <br>
> > [1]:<br>
> > <a href="https://github.com/scikit-image/scikit-image/pull/5103#issuecomment-739334463" rel="noreferrer" target="_blank">https://github.com/scikit-image/scikit-image/pull/5103#issuecomment-739334463</a><br>
> > [2]: <a href="https://github.com/scikit-image/scikit-image/pull/5103" rel="noreferrer" target="_blank">https://github.com/scikit-image/scikit-image/pull/5103</a><br>
> > [3]:<br>
> > <a href="https://github.com/scikit-image/scikit-image/pull/5103#issuecomment-739368765" rel="noreferrer" target="_blank">https://github.com/scikit-image/scikit-image/pull/5103#issuecomment-739368765</a><br>
> > <br>
> <br>
> I checked pandas and astropy and both have several uses of the<br>
> deprecated<br>
> types but should be easy to fix. I suppose the question is if we want<br>
> to<br>
> make them fix things *right now* :)<br>
> <br>
<br>
<br>
The reason why I thought it might be good to bring this up again is<br>
that I am not sure clear on how painful the deprecation is; which<br>
should be weighed against the benefit. And the benefit here is only<br>
moderate.<br></blockquote><div><br></div><div>It will be painful as in "lots of churn", but the fixes are straightforward. And it's clear many knowledgeable users didn't know they were aliases, so there is something to gain here.</div><div><br></div><div>Whether or not we revert the deprecation, I'd be in favor of improving the docs to answer the most common questions and pitfalls, like:</div><div><br></div><div>- What happens when I use Python builtin types with the dtype keyword?<br></div><div>- How do I check if something is an integer array? Or a NumPy or Python integer?<br></div><div>- What are default integer, float and complex precisions on all platforms?</div><div>- How do I iterate over all floating point dtypes when writing tests?</div><div>- Which of the many equivalent dtypes should I prefer? --> use float64, not float_ or double<br></div><div>- warning: float128 and float96 do not exist on all platforms</div><div>- <a href="https://github.com/scikit-learn/scikit-learn/wiki/C-integer-types%3A-the-missing-manual">https://github.com/scikit-learn/scikit-learn/wiki/C-integer-types%3A-the-missing-manual</a></div><div><br></div><div>Related: it's still easy to have things leak into the namespace unintentionally - `np.sys` and `np.os` exist too. I think we can probably clean those up without a deprecation, but we should write some more public API tests that prevent this kind of thing.</div><div><br></div><div>Cheers,<br></div><div>Ralf</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thus, with the things now in and a few more people exposed to it, if<br>
anyone thinks its a bad idea or that we should delay, I am all ears.<br>
<br>
Cheers,<br>
<br>
Sebastian<br>
<br>
<br>
> Chuck<br>
> _______________________________________________<br>
> NumPy-Discussion mailing list<br>
> <a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
<br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div></div>