Python Syntax and Semantics - Function Annotations

Function Annotations

Function annotations are defined in PEP 3107. They allow attaching data to the arguments and return of a function. The behaviour of annotations is not defined by the language - and left to third party frameworks. For example, a library could be written to handle static typing:

def haul(item: Haulable, *vargs: PackAnimal) -> Distance

Read more about this topic:  Python Syntax And Semantics

Famous quotes containing the word function:

    To look backward for a while is to refresh the eye, to restore it, and to render it the more fit for its prime function of looking forward.
    Margaret Fairless Barber (1869–1901)