🤷 Option and Result
This library uses code copied and pasted from Peijun Ma's option library, which they have generously published under the MIT license. 🙏
This is a Python implementation of Rust's Option and Result types in order to help make fallible functions identifiable and more robust than typical exceptions.
💻 Installation
This package is published to PyPI as babichjacob-option-and-result.
🛠 Usage
from option_and_result import NONE, Some, Ok, Err
maybe_a_number = Some(17)
assert maybe_a_number.unwrap() == 17
nothing = NONE()
assert nothing.is_none()
number_result = maybe_a_number.ok_or("not a number")
assert number_result == Ok(17)
result_that_is_err = Err("gah! an error!")
combinatoric_result = number_result.and_(result_that_is_err)
assert combinatoric_result.unwrap_err() == "gah! an error!"
# more methods on Options and Results are available like the Rust documentation shows
# there is also MatchesNone, MatchesSome, MatchesOk, and MatchesErr
# for use with Python 3.10's new structural pattern matching feature
😵 Help! I have a question
Create an issue and I'll try to help.
😡 Fix! There is something that needs improvement
Create an issue or pull request and I'll try to fix.
📄 License
MIT
🙏 Attribution
This README was generated with ❤️ by readme-md-generator
Metadata
Release files for babichjacob-option-and-result 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| babichjacob_option_and_result-0.2.3.tar.gz | 8.0 kB | Without provenance | Details for babichjacob_option_and_result-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| babichjacob_option_and_result-0.2.3-py3-none-any.whl | Python 3 | none | any | Details for babichjacob_option_and_result-0.2.3-py3-none-any.whl |
Total release size: 15.5 kB
Release files / babichjacob_option_and_result-0.2.3.tar.gz
| Download URL | babichjacob_option_and_result-0.2.3.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0952ad5c1d9d4fdc118d4400094015dbb7bc1390a76c0c42201c97d348bb8a1e
|
|
BLAKE2b-256 checksum How to use checksums |
fa653cdb49321557dade4ae4387fa92ade787577519dcf4d6a6133db3d60e5e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.11.2 Linux/5.15.0-1034-azure
|
Release files / babichjacob_option_and_result-0.2.3-py3-none-any.whl
| Download URL | babichjacob_option_and_result-0.2.3-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bac084ccb0c0771cf8ad2addb63f9451345e7e9d90363ba2570eb3cfb5ef4f38
|
|
BLAKE2b-256 checksum How to use checksums |
e1718f3440d8ff109e6104561d3f99714a9cdfd01ea42c6ec0f3226b99c0edfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.11.2 Linux/5.15.0-1034-azure
|
Security for babichjacob-option-and-result 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.