Content Deep Dive
Python errors as values: Comparing useful patterns from Go and Rust
Blog post from Inngest
Post Details
Company
Date Published
Author
Aaron Harper
Word Count
1,076
Language
English
Hacker News Points
41
Source URL
Summary
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.