"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-07 23:15:14.886202
"""

```python
from typing import Callable, Any


class FallbackExecutor:
    """
    A class for executing functions with fallback options in case of errors.

    Args:
        primary_function: The main function to execute.
        fallback_function: The function to use as a fallback if the primary function fails.
        exception_types: Optional list of exceptions to catch and handle by the fallback.
    
    Example usage:

    >>> def divide(a, b):
    ...     return a / b
    ...
    >>> def safe_divide(a, b):
    ...     print("Executing fallback due to division by zero")
    ...     return 0.0
    ...
    >>> fallback_executor = FallbackExecutor(
    ...     primary_function=divide,
    ...     fallback_function=safe_divide,
    ...     exception_types=(ZeroDivisionError,)
    ... )
    >>> result = fallback_executor.execute(10, 0)
    Executing fallback due to division by zero
    0.0

    """

    def __init__(self, primary_function: Callable[..., Any], fallback_function: Callable[..., Any], exception_types: tuple[type[BaseException], ...] | None = None):
        self.primary_function = primary_function
        self.fallback_function = fallback_function
        self.exception_types = exception_types if exception_types else (Exception,)  # Default to catching all exceptions

    def execute(self, *args, **kwargs) -> Any:
        try:
            return self.primary_function(*args, **kwargs)
        except self.exception_types as e:
            print(f"Error occurred: {e}. Fallback is executing.")
            return self.fallback_function(*args, **kwargs)


# Example usage
def safe_divide(a, b):
    print("Executing fallback due to division by zero")
    return 0.0

def main():
    def divide(a, b):
        return a / b

    executor = FallbackExecutor(
        primary_function=divide,
        fallback_function=safe_divide,
        exception_types=(ZeroDivisionError,)
    )

    result = executor.execute(10, 0)
    print(f"Result: {result}")

if __name__ == "__main__":
    main()
```