conditional_execute#

conditional_execute(func, execute_operation=False, alt_func=<function identity>)[source]#

Return the given function or alternative function based on execute_operation.

Parameters:
funcCallable

Callable.

alt_funcCallable

Callable to return if execute_operation is False, identity by default.

execute_operationbool

Whether to return func or a alt_func function.

Returns:
Callable

func if execute_operation else alt_func.