On 26 Nov 2017, 12:27 PM +1100, Nathaniel Smith <njs@pobox.com>, wrote:
It turns out that the PEP 484 type system is *mostly* not useful for
this. They're really designed for checking consistency across a large
code-base, not for enabling compiler speedups. For example, if you
annotate something as an int, that means "this object is a subclass of
int". This is enough to let mypy catch your mistake if you
accidentally pass in a float instead, but it's not enough to tell you
anything at all about the object's behavior -- you could make a wacky
int subclass that acts like a string or something.