function types are understood in the restrictive sense, specifying:
foo is declared to have a fixnum argument, then the
1+ in (foo (1+ x)) is compiled with knowledge that
the result must be a fixnum.
ftype implicitly declares the types of the arguments in the
definition. Python checks for consistency between the definition
and the ftype declaration. Because of precise type checking,
an error will be signaled when a function is called with an
argument of the wrong type.
fixnum, then when a call to
that function appears in an expression, the expression will be
compiled with knowledge that the call will return a fixnum.
ftype declaration is treated like an
implicit the wrapped around the body of the definition. If
the definition returns a value of the wrong type, an error will be
signaled. If the compiler can prove that the function returns the
wrong type, then it will give a compile-time warning.
This is consistent with the new interpretation of function types and
the ftype declaration in the proposed X3J13 cleanup “function-type-argument-type-semantics”. Note also, that if
you don’t explicitly declare the type of a function using a global
ftype declaration, then Python will compute a function type
from the definition, providing a degree of inter-routine type
inference, see function-type-inference.