qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 13/38] qapi/common.py: add type hint annotations


From: John Snow
Subject: Re: [PATCH v2 13/38] qapi/common.py: add type hint annotations
Date: Wed, 23 Sep 2020 13:57:25 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 9/22/20 6:44 PM, Eduardo Habkost wrote:
Does this need to require a Sequence?  It looks like it could be
Iterable.

I don't think this should block the patch, though, so:

Reviewed-by: Eduardo Habkost<ehabkost@redhat.com>

gen_if can take an Iterator, gen_endif needs a Sequence because it uses reversed().

I have not been very fastidious about choosing the MOST possibly abstracted type, but you are right that we SHOULD. I was hoping to find all occurrences of List and try slackening them to Collection/Sequence/Iterable etc, but as a follow-up.

In this case, since gen_endif actually does want the stricter type, I'm deciding to leave them as Sequence for signature parity.

--js

(P.S. in case it comes up in future review, there is a bug that prevents us from using Collection in 3.6: https://github.com/PyCQA/pylint/issues/2377 )




reply via email to

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