Dict Utils
Auto-generated documentation for fundom.pointfree.dict_utils module.
maybe_get
@hof1
def maybe_get(key: TKey, arg: dict[TKey, TValue]) -> TValue | None:
Point-free version if dict.get
with default None
.
Arguments
key
TKey - to get.arg
dict[TKey,TValue] - to get from.
Returns
TValue | None: value. |
See also
try_get
@hof1
@safe
def try_get(key: TKey, arg: dict[TKey, TValue]) -> TValue:
Point-free version of dict[key]
.
Error-safe, returns KeyError
in case key is not present and __missing__()
is
not provided.
Arguments
key
TKey - to get. arg (dict[TKey, TValue]): to get from.
Returns
TValue
- value.