On 12/29/23 05:15, Karsten Hilbert via Python-list wrote:
Hi all,

I am not sure why mypy thinks this

gmPG2.py:554: error: Argument "queries" to "run_rw_queries" has incompatible type 
"List[Dict[str, str]]"; expected
"List[Dict[str, Union[str, List[Any], Dict[str, Any]]]]"  [arg-type]
                     rows, idx = run_rw_queries(link_obj = conn, queries = 
queries, return_data = True)
                                                                           
^~~~~~~

should be flagged. The intent is for "queries" to be

a list
        of dicts
                with keys of str
                and values of
                        str OR
                        list of anything OR
                        dict with
                                keys of str
                                and values of anything

I'd have thunk list[dict[str,str]] matches that ?

Dict[str, str] means the key type and value type should both be strings, but in your retelling above you indicate lots of possible value types... actually the mypy guess seems to be a pretty good recreation of your psuedo-code description.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to