On 30/12/23 4:02 am, Karsten Hilbert wrote:
def run_rw_queries ( link_obj:_TLnkObj=None, queries:list[dict[str, str | list | dict[str, Any]]]=None,
Given that I would have thought that passing in list[dict[str, str]] for "queries" ought to be type safe.
dict[str, str] is not a subtype of dict[str, str | something_else] because you can assign a value of type something_else to the latter but not the former. In this case it happens to be okay because the function is (presumably) treating the dict passed in as immutable, but MyPy has no way to be sure of that. You could try declaring it as a collections.Mapping, which is immutable. -- Greg -- https://mail.python.org/mailman/listinfo/python-list