from dataclasses import dataclass from functools import partial from typing import Iterator @dataclass class ReducerParams: """ Dataclass that contains the current program state """ prompt_text: str player_points: int lm_points: int current_guesses: str lm_guesses: str remaining_attempts: int guess_field: str button_label: str bottom_html: str word_number: int def __iter__(self) -> Iterator: return map(partial(getattr, self), self.__dataclass_fields__) def __getitem__(self, index) -> str | int: return list(self)[index]