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 function of art is to do more than tell it like it is—it’s to imagine what is possible.
    bell hooks (b. c. 1955)