Maybe
A simple Maybe (Option) type for Python 3 inspired by Rust, fully type annotated.
Installation
Not yet available on PyPI. PyPI package coming soon.
Latest GitHub master branch version:
$ pip install git+https://github.com/rustedpy/maybe
Summary
Experimental. API subject to change.
The idea is that a possible value can be either Some(value) or Nothing(), with a way to differentiate between the two. Some and Nothing are both classes encapsulating a possible value.
Example usage,
from rustedpy-maybe import Nothing, Some
o = Some('yay')
n = Nothing()
assert o.unwrap_or_else(str.upper) == 'yay'
assert n.unwrap_or_else(lambda: 'default') == 'default'
License
MIT License
Metadata
Release files for rustedpy-maybe 0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rustedpy-maybe-0.0.0.tar.gz | 7.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rustedpy_maybe-0.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.5 kB
Release files / rustedpy-maybe-0.0.0.tar.gz
| Download URL | rustedpy-maybe-0.0.0.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7737f67186a74ea50db4e2511f1238560047b38a61c5e49b7f7e755b31a6aace
|
|
BLAKE2b-256 checksum How to use checksums |
87be64ecd947c8a6016073c8748a5a4a828b45bda5b8887ed7b057c0771f455d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / rustedpy_maybe-0.0.0-py3-none-any.whl
| Download URL | rustedpy_maybe-0.0.0-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0808636203133c69c1573f8b07c0375dd72b6ab1e5f32ef3ed42295ee63d93d3
|
|
BLAKE2b-256 checksum How to use checksums |
80d880df2f0a2532216550272b8f58b47554e244efe195869a3071b2f7c42094
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|