Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Python Type Hints

Python Type Hints

PyLadies lightning talk about Python type hints

Ayla Khan

May 16, 2018
Tweet

More Decks by Ayla Khan

Other Decks in Technology

Transcript

  1. What Are Python Type Hints? • New in 3.5 (provisional)

    • PEP484 • Optional (not enforced at runtime) ◦ Linter use recommended instead • Function annotations • Type Aliases, NewType, Callable, Generics ...
  2. Type Hints Advantages • Clarifies, “enforces” intent • Improves readability

    ◦ Simplifies type signatures • Improves testability • May prevent bugs