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

YouTube

Gradual Typing of Production Applications

code::dive conference via YouTube

Overview

Explore gradual typing in production Python applications through this comprehensive conference talk from code::dive 2017. Delve into the benefits of annotating Python code with types, understand the differences between type check errors and runtime errors, and learn about advanced typing concepts beyond simple class annotations. Discover how to handle various function return scenarios, including returning anything, specific types, or values of the same type as the input. Examine techniques for specifying complex input requirements, such as lists with string elements or functions accepting classes instead of objects. Gain insights into type inference, gradual typing workflows, and file-level vs. full program analysis. Address common gotchas in typed Python, including limitations of unions and mutable collections. Conclude with a discussion on where to find support for implementing gradual typing in your projects.

Syllabus

Intro
ŁUKASZ LANGA
WHAT WE'RE GOING TO TALK ABOUT
WHY ANNOTATE PYTHON CODE WITH TYPES?
TYPE CHECK ERROR VS. RUNTIME ERROR
THERE'S MORE TO TYPES THAN JUST CLASSES
WHAT IF A FUNCTION RETURNS ANYTHING?
WHAT IF A FUNCTION ONLY ACCEPTS LISTS WITH STRING ELEMENTS?
A STRING OR NONE?
WHAT IF A FUNCTION RETURNS A VALUE OF THE SAME TYPE AS PASSED AS AN ARGUMENT?
WHAT IF A FUNCTION ACCEPTS AN INT BUT IT'S REALLY EXPECTING ONLY FBIDS?
WHAT IF A FUNCTION ACCEPTS A CLASS, NOT AN OBJECT?
TYPE INFERENCE
GRADUAL TYPING
WORKFLOW SUGGESTION #2
FILE-LEVEL VS. FULL PROGRAM ANALYSIS
WORKFLOW SUGGESTION #3
WORKFLOW SUGGESTION #4
GOTCHAS
ONLY ANNOTATED FUNCTIONS ARE TYPED
UNIONS LIMIT ALLOWED BEHAVIOR
OUT OF ORDER DEFINITIONS IN PYTHON 3.7
IMPORT CYCLES IN PYTHON 3.7
MUTABLE COLLECTIONS ARE INVARIANT
CRAZY IDEAS
WHERE TO GET SUPPORT?

Taught by

code::dive conference

Reviews

Start your review of Gradual Typing of Production Applications

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.