I ported the Rust documentation as well, using docstrings. The examples in the docstrings are run as tests, and each doctest must be well-typed (according to mypy) for CI to pass.
There are a few reasons why I made this:
- mypy with typing.Optional can enforce checking for None, but it makes me miss Rust APIs like Option.map.
- Python will have pattern matching in 3.10, which will make this library more ergonomically feasible.
- It seemed like a fun and straightforward project.
I'm happy to answer any questions, and would love to hear your constructive criticism.