Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Practical Uses for Function Annotations

EuroPython Conference via YouTube

Overview

Explore practical applications of function annotations in Python during this 57-minute EuroPython 2013 conference talk. Delve into the concept of function annotations as syntactic sugar for adding metadata to function definitions. Learn how to leverage annotations for adding typing information, enhancing IDE and editor support, and implementing runtime checking. Discover the potential of structural interfaces, predicates, and function overloading using annotations. Examine different approaches to type annotations, including the 'rightarrow' library. Investigate how annotations can be utilized for language bridges and discuss reasons for their limited adoption in the Python community. Gain insights into advanced Python features and techniques to improve code quality and maintainability.

Syllabus

Intro
What are Function Annotations? Syntactic sugar for adding metadata to function definitions
Annotations are just syntactic sugar
Adding Typing Information
Helping tools (IDE, Editor)
Wait a sec!
Libraries usually do this
Experiment: Runtime checking
Runtime checking: how it looks
But isinstance is killing duck typing!
Another example
Implementation of structural interfaces
Types + behaviour = predicates
More fun with predicates
The open function annotated again
Unions
Function overloading
More kinds of types typedefs
A different approach to type annotations: rightarrow
Using rightarrow
Combining different uses of annotations
Annotations for language bridges
Why annotations are not used? • Not a wide know feature
Questions?

Taught by

EuroPython Conference

Reviews

Start your review of Practical Uses for Function Annotations

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.