opt4py.Option
- class opt4py.Option(value=None)
A container class that handles seamlessly NoneType checks in a monadic way.
- __init__(value=None)
Initializes a new Option object with a given value (defaults to None). :param value: Value stored at first inside the Option.
Methods
__init__([value])Initializes a new Option object with a given value (defaults to None).
is_none()Checks if the Option's value is None.
is_some()Checks if the Option contains something (opposite of is_none()).
map(f)Maps a method to the Option's value if it is not None.
unwrap()Unwraps the Option object into only its value.
unwrap_or(default)Unwraps the Option object into only its value.