~/talk

"How to Use Static Typing in Python with Type Hints, MyPy and Pydantic"

Talkat PyOhio 2024 · 2024-07-27..07-28· [python, typescript]
links:none on file
slides:none on file

Demonstrates using type hints together with MyPy and Pydantic to catch real errors: MyPy performs static analysis and flags incompatible assignments (e.g., assigning an int to a hinted str or appending an int to List[str]), while Pydantic validates at runtime, auto-coercing numeric strings into floats by default but raising ValidationError when conversion fails or when strict=True is set. Shows concrete class examples (Rectangle area/perimeter) and recommends incremental adoption and using Pydantic at system boundaries.

AI-written summary · about

  1. 0:00Static typing in Python
  2. 6:09Type hints basics
  3. 11:59MyPy static checking
  4. 15:18Pydantic runtime validation
  5. 22:04Tools working together
  6. 26:19Getting started
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.