Choosing the function to call depending on some condition
- function
- dispatch
- OP has two or more functions and wants to call one from among these depending on some condition or the value of a variable.
- OP has several functions and wants to call all of them.
Suboptimal alternatives range from a bunch of if
cases to eval
, whereas OP should use a dispatch dict or similar.