"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-05 20:48:05.507966
"""

```python
from typing import Callable, Any, Optional


class FallbackExecutor:
    """
    A class that provides a fallback mechanism for executing functions.
    If an exception occurs during the execution of the main function,
    it attempts to execute a fallback function.

    :param main_function: The primary function to be executed.
    :param fallback_function: The function to be executed in case of failure.
    """

    def __init__(self, main_function: Callable[..., Any], fallback_function: Optional[Callable[..., Any]] = None):
        self.main_function = main_function
        self.fallback_function = fallback_function

    def execute(self) -> Any:
        """
        Executes the main function. If an exception occurs,
        attempts to execute the fallback function.

        :return: The result of the executed function.
        """
        try:
            return self.main_function()
        except Exception as e:
            if self.fallback_function is not None:
                print(f"Error occurred in main function: {e}")
                return self.fallback_function()
            else:
                raise

    def __call__(self) -> Any:
        """
        Allows the instance to be called like a regular function.
        :return: The result of the executed function.
        """
        return self.execute()


def divide_numbers(a: int, b: int) -> float:
    """
    Divides two numbers and returns the result.

    :param a: Numerator
    :param b: Denominator
    :return: Result of division
    """
    return a / b


def safe_divide(numbers: list[int]) -> Optional[float]:
    """
    Safely divides elements in the list, handling ZeroDivisionError and returning None on failure.

    :param numbers: List of integers to be divided.
    :return: The result of division or None if an error occurs.
    """
    try:
        return divide_numbers(numbers[0], numbers[-1])
    except ZeroDivisionError:
        print("Cannot divide by zero.")
        return None


# Example usage
safe_divider = FallbackExecutor(main_function=divide_numbers, fallback_function=safe_divide)

result = safe_divider(10, 2)  # Normal execution
print(f"Result: {result}")

result = safe_divider(10, 0)  # Execution with fallback
print(f"Fallback result: {result}")
```