On Wed, Feb 14, 2018 at 5:49 PM, Chris Barker - NOAA Federal <
> > 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.
> mypy isn’t an “official” tool, but PEP484 is — and mypy is more or
> less a reference implimentation, yes?
Except PEP 484 is silent on many, many details. So far from all of mypy's
behavior is normative.
However, in this case PEP 484 has an opinion on the numbers module (don't
use it, just use int).
> mypy support bool, as far as I can tell, will that not work for your case?
> Even though the python bools are integer subclasses, that doesn’t mean
> a type checker shouldn’t flag passing an integer in to a function that
> expects a bool.
That's not the issue.
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
builtins.int. 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.
--Guido van Rossum (python.org/~guido)
Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/