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
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:
This would: (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.