~/talk

Type Hints: Putting more Buzz in your Fizz

Talkat PyCon US 2020 · 2020-04-15..04-23· [python, developer-experience]
links:none on file
slides:none on file

Shows concrete results: runs mypy and tox, annotates an over‑engineered fizzbuzz implementation, and fixes a real mismatch where returns mix strings and ints by switching to a Union or changing code. Demonstrates reveal_type revealing set[Any], uses forward references in quotes for circular types, and explains @dataclass and typing.NamedTuple plus stub files and type: ignore. Emphasizes which edits make mypy happy and when code refactoring wins.

AI-written summary · about

  1. 0:00Intro
  2. 1:40Topics
  3. 3:13Some basic tooling - mypy and fox
  4. 4:11Installing and Running
  5. 5:02Sample Project
  6. 7:35A simple case
  7. 7:49The Fizz-Buzz Party Game-Sit in a circle and count
  8. 9:52A Fizz Buzz Solution fizzbuzz2.py
  9. 11:23A Fizz Buzz Solution With Hints
  10. 12:54A Fizz Buzz Solution With Erroneous Hints
  11. 13:46Two Paths Forward
  12. 14:50Design Strategies
  13. 16:33Dealing with complex data structures
  14. 17:20We really wanted a mapping from number to fizz-buzz text
  15. 19:04Some code
  16. 20:04mypy needs some convincing
  17. 20:58Adding clarity
  18. 21:33Refactoring Phase 1: Simplify the Types
  19. 22:18Refactoring Phase II: Propagate the Simplifications
  20. 24:01Forward references and circularity
  21. 24:35Two Classes with Mutual References
  22. 26:07Don't Panic
  23. 27:06Here's the state of a number, FBState
  24. 28:48Debugging
  25. 29:57Some Example Code
  26. 31:16Common Sources of Complexity
  27. 33:57More Buzz in your Fizz
~/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.