~/talk

Functional Error Handling

Talkat PyCon US 2024 · 2024-05-15..05-23· [python]
slides:none on file

Claim: exceptions break composability because they aren’t part of the type system. Implementation: replace raises with a generic Result type (frozen dataclass) with distinct Success and Failure holding answer or error, catch exceptions into failures, and compose functions with a member bind that forwards unwrapped success or short‑circuits failures. Tooling: demonstrates the third‑party returns library and a comprehension‑based do notation for multiple args. Caveat: mypy needs an extension to fully track error unions and the extension can be fiddly to get working.

AI-written summary · about

  1. 0:00Functional error handling intro
  2. 2:10Composability principle
  3. 5:02Error handling history
  4. 7:11Exceptions fail at scale
  5. 10:26Functional error handling approach
  6. 13:21Introducing Result type
  7. 17:06Composing with Result
  8. 21:26Simplifying bind and do
  9. 26:29Languages adopting functional errors
  10. 27:53Q&A
~/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.