syntacticallyfunction annotations are coded in def header linesas arbitrary expressions associated with arguments and return values for argumentsthey appear after colon immediately following the argument' namefor return valuesthey are written after -following the arguments list this codefor exampleannotates all three of the prior function' argumentsas well as its return valuedef func( 'spam' ( )cfloat-intreturn func( calls to an annotated function work as usualbut when annotations are present python collects them in dictionary and attaches it to the function object itself argument names become keysthe return value annotation is stored under key "returnif coded (which suffices because this reserved word can' be used as an argument name)and the values of annotation keys are assigned to the results of the annotation expressionsfunc __annotations__ {' '' '( )' ''spam''return'because they are just python objects attached to python objectannotations are straightforward to process the following annotates just two of three arguments and steps through the attached annotations genericallydef func( 'spam'bc )return func( func __annotations__ {' ' ' ''spam'for arg in func __annotations__print(arg'=>'func __annotations__[arg] = =spam there are two fine points to note here firstyou can still use defaults for arguments if you code annotations--the annotation (and its characterappear before the default (and its characterin the followingfor examplea'spam means that argument defaults to and is annotated with the string 'spam'def func( 'spam ( cfloat -intreturn func( func( advanced function topics (all defaults