I have a type like the following, with an extra string argument all
. I was hoping something like this would work.
Note: MY_LIST is a list of strings.
list[Literal[MY_LIST]] | Literal["all"]
Error:
File "/home/Me/.pyenv/versions/3.11.1/lib/python3.11/typing.py", line 1672, in __hash__
return hash(frozenset(_value_and_type_iter(self.__args__)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unhashable type: 'list'
What is the correct command?