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:

    Literature does not exist in a vacuum. Writers as such have a definite social function exactly proportional to their ability as writers. This is their main use.
    Ezra Pound (1885–1972)