[Python-Dev] PEP 0484 - the Numeric Tower
Stephen J. Turnbull
stephen at xemacs.org
Thu Oct 15 05:13:06 EDT 2015
Laura Creighton writes:
> [W]hat I expect the type annotations to be used for, especially in
> the SciPy world, is to make things easier for Numba to generate
> fast code.
I don't understand why that's a problem. *You* run mypy, and *you*
decide whether to do anything about its warnings. The application you
want to run is still a Python program, as are the modules it imports,
and the Python compiler still simply attaches the annotations to the
functions and otherwise ignores them, as does the VM.
So, running the type checker is optional, just like running a profiler
or pylint. How does the availability of profiling tools and linters
hurt you? If they don't hurt, why would an optional analysis tool
that happens to check types be a problem? It seems to me it wouldn't,
but maybe I'm missing something?
Unless you expect the Numba people themselves to require annotations
before you can use Numba at all. In any case, that's not a problem
created by PEP 484. Annotations have been available since 2006,
decorator-based type-checkers since around 2003, and LBYL type-
checking at runtime since the beginning of time. If Numba was going
to require type annotations, they could have devised an annotation
syntax themselves and done it long ago. Why would they, or any other
project, change to a LBYL approach now? I would expect that Bokeh
would be much less likely than Numba to do that, for example.
> I now know that what a large number of people who want faster code,
> really want is magic Fairy Dust.
And a pony. And they think Santa Claus will deliver on Christmas.
But I don't understand why that interferes with what you want to do.
OK, if you think annotations are ugly and don't want to see them ever,
fine, that I can understand (though I don't sympathize, at least not
yet -- we'll see how badly they get abused in libraries I use). But
how do they actually cause a problem when you're just running your
code? I must be missing something ....
More information about the Python-Dev