4 ms·
ad the last point: Isn't this perfectly fine in principle (minus the fact that Mypy is third-party)? Compilers in static languages also work only with the sourc
by azag0 10y ago
ad the last point: Isn't this perfectly fine in principle (minus the fact that Mypy is third-party)? Compilers in static languages also work only with the source code, in a way, as there is no runtime interpreter. So there should be no reason for type checkers on dynamic languages to require the runtime. Granted, this forces you to essentially write type-statically in a dynamic language, which might limit your expressiveness, but that's probably your point anyway if you do type checking. Now I'm not saying that Mypy is anywhere near this hypothetical situation. My point is that type checkers over dynamic languages should not need the runtime in principle. Conversely, the runtime should not need to do the type checking, for performance.
- ubernostrum 10y agoMany people, when they hear "static types for Python", expect that the Python interpreter would perform some kind of pre-execution step of checking types and usage, and refuse to execute code with type errors. Since this is not the case (and would be difficult/impossible to implement given that Python code can import new modules at any time, and also change the import paths), it's worth pointing out.