Hacker News new | ask | show | jobs
by ifightcrime 2935 days ago
I’m confused. How does mypy make python slower? I thought it was “compile time” and doesn’t affect runtime.
2 comments

I'm not sure what to make of that statement either. It is like saying running a linter on your code makes it slower. It just doesn't make any sense.

If the author argued that annotations made the code slower… maybe. CPython exposes them on, e.g., __annotations__, so, conceivably that would slow down function creation and consume more memory, but my guess would be it would be such a tiny difference that would be vastly outweighed by the benefits of having annotations.

You're right, this was a mistake on my part. I'll correct this in the post. I have used mypy further since the post was written and it is indeed quite helpful, particularly in --strict mode.