libfunc: functional-programming helping tools

Tools for Functional-Programming in Python.

From: https://github.com/joaomcteixeira/libfuncpy

haddock.libs.libfunc.chainf(init: Any, *funcs: Callable[[...], Any], **common: Any) Any[source]

Apply a sequence of functions to an initial value.

Example

>>> chainf(2, *[str, int, float])
2.0
Parameters:
  • init (anything) – The initial value.

  • **common (keyword arguments) – Common key word arguments to all functions.

Returns:

anything – The result of the chain of functions; this is, the return value of the last function.

haddock.libs.libfunc.chainfs(*funcs: Callable[[...], Any], **common: Any) Callable[[...], Any][source]

Store functions be executed on a value.

Example

>>> do = chainfs(str, int, float)
>>> do(2)
2.0

See also

chainf()

haddock.libs.libfunc.false(*ignore: Any, **everything: Any) Literal[False][source]

Give False regardless of the input.

haddock.libs.libfunc.give_same(value: Any) Any[source]

Return what is given.

haddock.libs.libfunc.nan(*ignore: Any, **everything: Any) float[source]

Give nan regardless of the input.

haddock.libs.libfunc.none(*ignore: Any, **everything: Any) Literal[None][source]

Give None regardless of the input.

haddock.libs.libfunc.not_none(value: Any) bool[source]

Give True if value is not None, or False otherwise.

haddock.libs.libfunc.true(*ignore: Any, **everything: Any) Literal[True][source]

Give True regardless of the input.