3 ms·
Show HN: Rust-like error handling in Python thanks to PEP 622
- mtasic 6y agoAuthor here, I initially dockerized brandtbucher/cpython repo [1] which I found mentioned in official PEP 622 [2]. All credits go to original authors. Since this is not a production ready project, and will eventually die once PEP 622 is integrated in CPython repo, on purpose I named it cpython-3.10.0-alpha-0 as distraction. After I got it working, I wanted to explore some ideas. I like both Python and Rust, so I wanted to try implementing something similar to Rust's Result type. End result is something I was looking for a long time in Python. [1] https://github.com/brandtbucher/cpython https://github.com/brandtbucher/cpython [2] https://www.python.org/dev/peps/pep-0622 https://www.python.org/dev/peps/pep-0622
- danpozmanter 6y agoThis is fantastic!! There's also elements of F# in this, it'd be wonderful to be able to do this in Python code.