Am Sat, Jan 13, 2024 at 09:20:00PM +0100 schrieb Karsten Hilbert via Python-list:
> > I was wondering if > > your type hint for queries shouldn't be the following. > > > > queries:list[dict[str,str]|dict[str,list]|dict[str,dict[str, dict[str, > > Ant]]] Wait, not really. Let me give an example. Here's three times the same query (as far as PostgreSQL is concerned, after having been passed through psycopg2): queries = [ { 'SQL': 'SELECT 1' }, { 'SQL': 'SELECT %s', 'args': [1] }, { 'SQL': 'SELECT %(value)s', 'args': {'value': 1} } ] The value for key "SQL" will always be str-like. The value for "args" can be a list or a dict itself. If "args" is a dict it will be of type [str, Any]. That's what I am trying to tell mypy. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list