Python errors as values: Comparing useful patterns from Go and Rust
This article discusses error handling in programming languages, comparing thrown errors with errors as values. It highlights that while Python traditionally uses thrown errors, returning errors as values can be more effective for handling and documenting errors. The author demonstrates how to handle errors as values in Python using different approaches such as tuples, the Result library, and unions. They conclude by explaining why they chose to use unions for error handling in their Python SDK.
Company
Inngest
Date published
Nov. 8, 2023
Author(s)
Aaron Harper
Word count
1076
Hacker News points
41
Language
English