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:

    The press and politicians. A delicate relationship. Too close, and danger ensues. Too far apart and democracy itself cannot function without the essential exchange of information. Creative leaks, a discreet lunch, interchange in the Lobby, the art of the unattributable telephone call, late at night.
    Howard Brenton (b. 1942)