~/talk

Static type checking with mypy

Talkat Swiss Python Summit 2022 · on Thursday, 2022-09-22· [python, typescript]
links:none on file
slides:none on file

Mypy performs static checks on Python annotations with practical features: type inference so only parameters and returns need annotations, Union/Optional with type narrowing to avoid None errors, assert_never checks exhaustiveness for unions, and Protocols for structural typing. Examples include flagging passing a string where an int is expected and using NewType prevents ID mix-ups so company_id and order_id aren’t interchangeable. Problems include untyped third‑party libs and Any turning checks off; strict mode and CI integration mitigate those.

AI-written summary · about

  1. 0:00Introduction to mypy
  2. 1:10What is mypy
  3. 2:13Type annotations basics
  4. 3:59Type inference in mypy
  5. 5:26Special types like NoReturn
  6. 7:14Union types and enums
  7. 9:47Type guards and narrowing
  8. 12:16Protocols and structural typing
  9. 14:47Generics in mypy
  10. 16:35New types for safety
  11. 19:50Problems with mypy
  12. 22:46Limitations and strict mode
  13. 23:06Q&A session
~/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.