One can hope that cpython will use them, one day

"if a parameter is typed as an int, then only run the specialized 'int' code to process it"

This would increase performance and make typing more useful

Without significant language changes, this is not possible. While your code may be typed as an int, I can simply redefine what int means. I can also modify the code in your method.

Yes

I guess it would work with the ongoing jit work, which (as far as I understood..) run the code "as usual", then notice that a specific variable is always a dict (or whatever). Then it patches the code to run the dict-optimized code by default (and fallback to the generic code if, somehow, the variable is no longer a dict).

With typing, the generic code could be avoided altogether. The algorithm would be:

  - notice that some variable can be processed by a dict-optimized code (because its typing is a dict, or something that looks like a dict etc)
  - when processing, check that the variable is indeed a "dict", raise an exception if not
  - run the optimized code
  - if the typing information changes (because the class has been redefined and the variable is no longer a "dict"), then go to step 1 and either stick with the current optimized code, use another one, or use the generic one
This would:

  - enforce types (you said that variable is a Thing but a Thing was not given: exception)
  - improve the jit by removing the bootstrap phase (where the jit watches and then try to guess what could be improved)

(or perhaps this is a stupid idea that cannot work :) )

There are already some bits of this with specific bytecode and the upcoming jit, it's not using annotations at all though

I think you're forgetting that int is actually what other people call a BigInt, an integer with unlimited precision, not int32 or int64.