Optional object for python
Project description
PyOptional
optional object for python
How to use
Optional.of & Optional.of_nullable
from pyoptional import Optional
value = 1
final_value = Optional.of(value).map(lambda x: x + 1).or_else(333)
assert final_value == 1
final_value = Optional.of_nullable(None).map(lambda x: x + 1).or_else(333)
assert final_value == 333
or_raise
Optional.of_nullable(None).or_raise(ValueError("value is None"))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
optional_python-0.0.1.tar.gz
(5.5 kB
view hashes)
Built Distribution
Close
Hashes for optional_python-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 940c6a90094946312c42764b97830cb48d39d3bc54bfbbf9d2638cb2cf82a223 |
|
MD5 | 59a9a9d8f6604b4c72a3f2d66a61e003 |
|
BLAKE2b-256 | 006372e7d379881c8d7e2af3ce1d1619a4a4499f79b40b243695fc7ab9ab7c3e |