<div dir="ltr"><div dir="ltr">On Sat, Dec 5, 2020 at 9:24 PM Mark Harfouche <<a href="mailto:mark.harfouche@gmail.com">mark.harfouche@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><p style="margin:0px 0px 1.2em">If the answer is to deprecate<br></p>
<pre style="font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;background-color:rgb(248,248,248);white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block"><a href="http://np.int" target="_blank">np.int</a>(1) == int(1)
</code></pre><p style="margin:0px 0px 1.2em">then one can add a warning to the <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">__init__</code> of the <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline"><a href="http://np.int" target="_blank">np.int</a></code> class, but continue to subclass the python <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">int</code> class.</p>
<p style="margin:0px 0px 1.2em">It just doesn’t seem worthwhile to to stop people from using <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">dtype=<a href="http://np.int" target="_blank">np.int</a></code>, which seem to read:</p>
<p style="margin:0px 0px 1.2em">“I want this to be a numpy integer, not necessarily a python integer”.<br></p></div></blockquote><div>The problem is that there is assuredly code that inadvertently relies upon this (mis)feature.</div><div><br></div><div>If we change the behavior of <a href="http://np.int">np.int</a>() to create np.int64() objects instead of int() objects, it is likely to result in breaking some user code. Even with a prior warning, this breakage may be surprising and very hard to track down. In contrast, it's much safer to simply remove <a href="http://np.int">np.int</a> entirely, because if users ignore the deprecation they end up with an error.</div><div><br></div><div>This is a general feature for deprecations: it's much safer to remove functionality than it is to change behavior.</div><div><br></div><div>So on the whole, I think this is the right call.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><p style="margin:0px 0px 1.2em"></p>
<div title="MDH:PGRpdj5JIGd1ZXNzIGlmIHRoZSBhbnN3ZXIgaXMgdG8gc3RvcCBwZW9wbGUgZnJvbSA8YnI+PC9k
aXY+PGRpdj48YnI+PC9kaXY+PGRpdj5gYGA8L2Rpdj48ZGl2PmZyb20gbnVtcHkgaW1wb3J0ICo8
L2Rpdj48ZGl2PmBgYDwvZGl2PjxkaXY+dGhlcmUgaXMgYSBnb29kIGZpeCBmb3IgdGhhdCBkb2Vz
bid0IGludm9sdmUgZGVwcmVjYXRpbmcgYGR0eXBlPW5wLmludGAuIDxicj48L2Rpdj48ZGl2Pjxi
cj48L2Rpdj48ZGl2PklmIHRoZSBhbnN3ZXIgaXMgdG8gZGVwcmVjYXRlPC9kaXY+PGRpdj5gYGA8
L2Rpdj48ZGl2Pm5wLmludCgxKSA9PSBpbnQoMSk8L2Rpdj48ZGl2PmBgYDwvZGl2PjxkaXY+dGhl
biBvbmUgY2FuIGFkZCBhIHdhcm5pbmcgdG8gdGhlIGBfX2luaXRfX2Agb2YgdGhlIGBucC5pbnRg
IGNsYXNzLCBidXQgY29udGludWUgdG8gc3ViY2xhc3MgdGhlIHB5dGhvbiBgaW50YCBjbGFzcy48
L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2Pkl0IGp1c3QgZG9lc24ndCBzZWVtIHdvcnRod2hpbGUg
dG8gdG8gc3RvcCBwZW9wbGUgZnJvbSB1c2luZyBgZHR5cGU9bnAuaW50YCwgd2hpY2ggc2VlbSB0
byByZWFkOjwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+Ikkgd2FudCB0aGlzIHRvIGJlIGEgbnVt
cHkgaW50ZWdlciwgbm90IG5lY2Vzc2FyaWx5IGEgcHl0aG9uIGludGVnZXIiLjwvZGl2PjxkaXY+
PGJyPjwvZGl2PjxkaXY+PGJyPjwvZGl2Pg==" style="height:0px;width:0px;max-height:0px;max-width:0px;overflow:hidden;font-size:0em;padding:0px;margin:0px"></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Dec 5, 2020 at 10:14 PM Charles R Harris <<a href="mailto:charlesr.harris@gmail.com" target="_blank">charlesr.harris@gmail.com</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"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Dec 5, 2020 at 4:31 PM Juan Nunez-Iglesias <<a href="mailto:jni@fastmail.com" target="_blank">jni@fastmail.com</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">Hi all,<br>
<br>
At the prodding [1] of Sebastian, I’m starting a discussion on the decision to deprecate np.{bool,float,int}. This deprecation broke our prerelease testing in scikit-image (which, hooray for rcs!), and resulted in a large amount of code churn to fix [2].<br>
<br>
To be honest, I do think *some* sort of deprecation is needed, because for the longest time I thought that np.float was what np.float_ actually is. I think it would be worthwhile to move to *that*, though it’s an even more invasive deprecation than the currently proposed one. Writing `x = np.zeros(5, dtype=int)` is somewhat magical, because someone with a strict typing mindset (there’s an increasing number!) might expect that this is an array of pointers to Python ints. This is why I’ve always preferred to 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 Sebastian wants to see. ;) For skimage we’ve already merged a fix (even if it is one of dubious quality, as Stéfan points out [3] ;), so I don’t have too much stake in the outcome.<br>
<br>
Juan.<br>
<br>
[1]: <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]: <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>
</blockquote><div><br></div><div>I checked pandas and astropy and both have several uses of the deprecated types but should be easy to fix. I suppose the question is if we want to make them fix things <i>right now</i> :)</div><div><br></div><div>Chuck </div></div></div>
_______________________________________________<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>
_______________________________________________<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>