mypy question

Barry barry at barrys-emacs.org
Sat Dec 30 13:05:58 EST 2023



> On 30 Dec 2023, at 15:11, Karsten Hilbert via Python-list <python-list at python.org> wrote:
> 
> queries = [{'SQL': 'SELECT %(value)s', 'args': {'value': 1}}]
> 
> and
> 
> run_queries(conn, queries:list[str|dict[str, Any]]):

In cases like this I often use a wrapper class in place of a simple str.
If you have a class SqlString then your type becomes list[SqlString].

You may find that SqlString gains interesting methods over time.

 Barry


More information about the Python-list mailing list