Steve D'Aprano <steve+pyt...@pearwood.info> writes: > Since it is *optional*, it is only a hint, not a fact. You can tell the > compiler that you believe that n will be an int, but it's not guaranteed.
The runtime could check at the entry to the function that n is an int, and then it wouldn't have to keep re-checking on the inside of a loop. That's what a JIT compiler does in the absence of annotations, more or less; but the annotations make life easier for ahead-of-time compilers. Again this type of thing has been standard in Lisp since the 1960's. -- https://mail.python.org/mailman/listinfo/python-list