diff --git a/pytato/array.py b/pytato/array.py index 2771d835e..513398643 100644 --- a/pytato/array.py +++ b/pytato/array.py @@ -164,7 +164,7 @@ import operator import attrs from typing import ( - Optional, Callable, ClassVar, Dict, Any, Mapping, Tuple, Union, + KeysView, Optional, Callable, ClassVar, Dict, Any, Mapping, Tuple, Union, Protocol, Sequence, cast, TYPE_CHECKING, List, Iterator, TypeVar, FrozenSet, Collection) @@ -817,7 +817,12 @@ def __iter__(self) -> Iterator[str]: return iter(self._data) def __repr__(self) -> str: - return "DictOfNamedArrays(" + str(self._data) + ")" + return "DictOfNamedArrays(" + repr(self._data) + ")" + + # Note: items() and values() are not implemented here, they go through + # __iter__()/__getitem__() above. + def keys(self) -> KeysView[str]: + return self._data.keys() # }}}