map_global¶
- guppyft.globals.map_global(callback_func: Callable[[Concatenate[G, P]], G | tuple[G, Unpack[R]]], *args: P, **kwargs: P) tuple[Unpack[R]]¶
Call the given function with the given (keyword-)arguments and provide the current value stored in the global state variable to the function as the first parameter. The function must return a new value to store in the global state variable after the call has returned.
Note: All calls to this function will currently use the same global variable name to store and provide the global state.
- Parameters:
callback_func – The function to call with the value stored in the global variable.
args – Regular arguments to pass to the function.
kwargs – Keyword arguments to pass to the function.
- Returns:
The value(s) returned by the called function, excluding the updated global state, None when the called function does not return values besides the state.