Type Hints: Adding Types To Legacy Codebases

By Iyanuoluwa Ajao

Elevator Pitch

Python is often described as a dynamic language and this is one of the selling point of the language especially to beginner developers and academicians. Python 3.6 introduced type hints but this feature is not so popular among developers. This talk will help the audience understand type hints

Description

Description

Python 3.6 allowed developers to add types to their code but most developers are not yet familiar with type hinting. Most developers don’t know what type hinting really means and how it can benefit their development work flow. There are even developers that believe that the introduction of type hints to Python is against the philosophy behind the creation of the language in the first place. This talk will expose developers to one of the nicest feature of Python 3.6.

Who and Why

This talk is for the following categories of developers:

  1. Intermediate developers that want to learn the new cool feature of Python 3.6
  2. Advanced developers that believe Type hints is against the Zen of Python - Beautiful is better than ugly.
  3. Advanced developers that want to improve their developer workflow

At the end of this talk, developers must have fully grasped what Type hints is all about and how to get started with type hints

Outline

  1. Type Hints

    • What is Type Hints

    • The Difference between Type Hinting and Static Typing

    • Advantages of Type hinting to a developer workflow

    • How Type Hints is better than Adding comments

    • The Zen of Python - Explicit is better than Implicit

  2. Getting Started with Type hinting

    • The basics of Type hints and Examples

    • The limitations and Examples

    • How to get around this limitations and Examples

  3. Adding types to legacy codebases

    • Gradual Typing

    • Tools - MyPy, Pyre, MonkeyType