<div dir="ltr"><div dir="ltr">On Sun, Dec 6, 2020 at 12:52 AM Stephan Hoyer <<a href="mailto:shoyer@gmail.com">shoyer@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"><div dir="ltr">On Sat, Dec 5, 2020 at 9:24 PM Mark Harfouche <<a href="mailto:mark.harfouche@gmail.com" target="_blank">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" target="_blank">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" target="_blank">np.int</a> entirely, because if users ignore the deprecation they end up with an error.</div></div></div></blockquote><div><br></div><div>FWIW (and IIRC), <i>this</i> was the original misfeature. `<a href="http://np.int">np.int</a>`, `np.bool`, and `np.float` were aliases for their corresponding default scalar types in the first numpy releases. However, too many people were doing `from numpy import *` and covering up the builtins. We renamed these aliases with trailing underscores to avoid that problem, but too many people (even in those early days) still had uses of `dtype=<a href="http://np.int">np.int</a>`. Making `<a href="http://np.int">np.int</a> is int` was the backwards-compatibility hack.</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Robert Kern</div></div>