qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 12/22] qapi/parser: add type hint annotations


From: John Snow
Subject: Re: [PATCH 12/22] qapi/parser: add type hint annotations
Date: Mon, 26 Apr 2021 19:55:15 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

On 4/25/21 8:34 AM, Markus Armbruster wrote:
value: object isn't wrong, but why not _ExprValue?


Updated excuse:

because all the way back outside in _parse, we know that:

1. expr is a dict (because of get_expr(False))
2. expr['pragma'] is also a dict, because we explicitly check it there.
3. We iterate over the keys; all we know so far is that the values are ... something.
4. _pragma()'s job is to validate the type(s) anyway.

More or less, the _ExprValue type union isn't remembered here -- even though it was once upon a time something returned by get_expr, it happened in a nested call that is now opaque to mypy in this context.

So, it's some combination of "That's all we know about it" and "It happens to be exactly sufficient for this function to operate."

--js




reply via email to

[Prev in Thread] Current Thread [Next in Thread]