opt4py
Adds to Python an Option container class that handles seamlessly NoneType checks in a monadic way. Similar to Option
in Rust or Optional in Java, but it also overloads every operator for a smooth use without worries.
Usage
>>> from opt4py import Option
>>> Option(1)
Option(1)
>>> Option("Hello World!")
Option(Hello World!)
>>> Option()
Option(None)
>>> Option(1) + 1
Option(2)
>>> Option(2) * Option(2)
Option(4)
>>> Option(5).unwrap()
5
>>> Option(8).map(lambda x: x*2)
Option(16)
>>> Option(2) == 2
True
>>> Option(2) > 3
False
Metadata
Release files for opt4py 1.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 | |
|---|---|---|---|
| opt4py-1.0.0.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opt4py-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.7 kB
Release files / opt4py-1.0.0.tar.gz
| Download URL | opt4py-1.0.0.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d970699d9bb0e9687e54af01b3cd550df5c473136d78cfdac436fdaa17ff95bc
|
|
BLAKE2b-256 checksum How to use checksums |
d2f9cb04e1214281d2880d495245d7cded7653e69b5d95d703fecb17ad707f70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Release files / opt4py-1.0.0-py3-none-any.whl
| Download URL | opt4py-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
884b868bd0c168bc513553ebdbff392dd8048abea5612a94691d4dd31d25cc8c
|
|
BLAKE2b-256 checksum How to use checksums |
a66bbfbdd31695aa7e15591f4702a0c0998bc1dbaee18c4ffd3cf02f723e8be8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|