aspis.common.always

aspis.common.always(x)[source]

Returns a function that always returns the same value.

Parameters:

x (Any) – The value to be returned by the function.

Returns:

A function that always returns the value x.

Return type:

Callable

Example

>>> always_42 = always(42)
>>> always_42()
42
>>> always_42(1, 2, 3)
42