On Sun, 31 Dec 2023 at 00:35, Left Right wrote:
>
> It's not for you to choose the way I communicate. There are accepted
> boundaries, and I'm well within those boundaries. Anything beyond that
> is not something I'm even interested in hearing your opinion on.
You might not be interested in my
> You are conflating several different groups of people. The PyPA are
> the people who currently maintain the code for various
> libraries/tools. That is very often not the same as the people who
> originally wrote the code for the same libraries/tools or for
> preceding ones. Neither group is the
On 31/12/23 10:06 am, Thomas Passin wrote:
my suggestion above does
work, *except* that you cannot mix-and-match different DictTypex types
Have you tried declaring the argument as a Mapping instead of a dict?
Seeing as Thomas Passin's Sequence experiment worked, it seems like this
should work
On 31/12/23 8:05 am, Chris Angelico wrote:
Ah, I think you've hit on the problem there. Consider this:
def add_item(stuff: dict[str: str | int]):
stuff["spam"] = "ham"
stuff["vooom"] = 1_000_000
Yep, that's it exactly. It's not the union itself that's the problem,
but the fact that
On 12/30/2023 9:14 AM, Thomas Passin via Python-list wrote:
On 12/29/2023 10:02 AM, Karsten Hilbert via Python-list wrote:
I agree that mypy's grasp of my intent from
queries:list[dict[str, str | list | dict[str, Any]]]=None,
into
"List[Dict[str, Union[str, List[Any], Dict[str,
On Sun, 31 Dec 2023 at 03:38, Thomas Passin via Python-list
wrote:
> I am not very expert in Python type hints. In working up the example
> program I just posted, I got an error message from mypy that remarked
> that "list" is invariant, and to try Sequence which is "covariant". I
> don't know
> On 30 Dec 2023, at 15:11, Karsten Hilbert via Python-list
> 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
> I'm fairly sure your database queries don't actually give you strings or
> dicts, right? You probably get lists (or iterators) of tuples and
> somewhere you convert them to the arguments you are feeding to
> run_queries().
Ah, no, those queries are enshrined within the middleware as Python
On 12/29/2023 10:02 AM, Karsten Hilbert via Python-list wrote:
Am Fri, Dec 29, 2023 at 07:49:17AM -0700 schrieb Mats Wichmann via Python-list:
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
> It occurs to me that you could simplify things if you converted those
> plain query strings to dicts:
>
> 'SELECT 1' --> {'SQL': 'SELECT 1'}
Ha, indeed. There's likely not that many "simple string SQL queries"
in that codebase so I shall take it as an opportunity to refactor them.
So, at least
On 12/30/2023 10:08 AM, Karsten Hilbert via Python-list wrote:
Dear Thomas,
thanks for taking the time to look into my issue.
Maybe it helps if I explain what I want (sorry that my web mailer does not
respect
indentation, I will insert dots).
I want a function to run SQL queries:
On 12/30/2023 10:08 AM, Karsten Hilbert via Python-list wrote:
Dear Thomas,
thanks for taking the time to look into my issue.
Maybe it helps if I explain what I want (sorry that my web mailer does not
respect
indentation, I will insert dots).
I want a function to run SQL queries:
Dear Thomas,
thanks for taking the time to look into my issue.
Maybe it helps if I explain what I want (sorry that my web mailer does not
respect
indentation, I will insert dots).
I want a function to run SQL queries:
run_queries(conn, queries):
...for q in queries:
..conn.execute(q)
I
On 29/12/2023 01:05, FĂ©lix An via Python-list wrote:
> I'm used to C# WinForms, which has an easy-to-use drag-and-drop GUI
> designer in Visual Studio. Is there anything similar for Tk? How about
> Qt?
There are any number of them but few that work well. The best
I found was Dabo but it uses
On 12/29/2023 10:02 AM, Karsten Hilbert via Python-list wrote:
I agree that mypy's grasp of my intent from
queries:list[dict[str, str | list | dict[str, Any]]]=None,
into
"List[Dict[str, Union[str, List[Any], Dict[str, Any"
seems accurate. I just don't understand why
Peter J. Holzer wrote:
> [-- text/plain, encoding quoted-printable, charset: us-ascii, 40 lines --]
>
> On 2023-12-29 09:01:24 -0800, Grant Edwards via Python-list wrote:
> > On 2023-12-28, Peter J. Holzer via Python-list
> > wrote:
> > > On 2023-12-28 05:20:07 +, rbowman via Python-list
Hi Greg,
> 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.
I understand what you are saying but I do not yet understand why this
applies to my situation.
I don't have Python at hand
On 2023-12-29 09:01:24 -0800, Grant Edwards via Python-list wrote:
> On 2023-12-28, Peter J. Holzer via Python-list wrote:
> > On 2023-12-28 05:20:07 +, rbowman via Python-list wrote:
> >> On Wed, 27 Dec 2023 03:53:42 -0600, Greg Walters wrote:
> >> > The biggest caveat is that the shared
18 matches
Mail list logo