<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Feb 14, 2018 at 5:49 PM, Chris Barker - NOAA Federal <span dir="ltr"><<a href="mailto:chris.barker@noaa.gov" target="_blank">chris.barker@noaa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">><br>
> So as long as you are not expecting to ever need mypy you should be fine -- however if you're sharing code at some point someone is probably going to want to point mypy at it.<br>
<br>
</span>mypy isn’t an “official” tool, but PEP484 is — and mypy is more or<br>
less a reference implimentation, yes?<br></blockquote><div><br></div><div>Except PEP 484 is silent on many, many details. So far from all of mypy's behavior is normative.<br><br></div><div>However, in this case PEP 484 has an opinion on the numbers module (don't use it, just use int).<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
mypy support bool, as far as I can tell, will that not work for your case?<br>
<br>
Even though the python bools are integer subclasses, that doesn’t mean<br>
a type checker shouldn’t flag passing an integer in to a function that<br>
expects a bool.<br></blockquote></div><br></div><div class="gmail_extra">That's not the issue.<br><br></div><div class="gmail_extra">The issue is that, from mypy's POV, np.bool is not a subtype of builtins.bool, just like the various np.intXX types aren't subtypes of <a href="http://builtins.int">builtins.int</a>. But IMO the solution is to lie about this in the stubs and make the np types subtypes of the builtin types, not to switch to numbers.Integral. And the reason is that few people (outside hardcore np fans) will want to write numbers.Integral instead of int.<br clear="all"></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div></div>