[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 09/20] python/qemu: make 'args' style arguments immutable
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH 09/20] python/qemu: make 'args' style arguments immutable |
Date: |
Wed, 7 Oct 2020 06:55:57 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 |
On 10/7/20 1:58 AM, John Snow wrote:
> These arguments don't need to be mutable and aren't really used as
> such. Clarify their types as immutable and adjust code to match where
> necessary.
>
> In general, It's probably best not to accept a user-defined mutable
> object and store it as internal object state unless there's a strong
> justification for doing so. Instead, try to use generic types as input
> with empty tuples as the default, and coerce to list where necessary.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> Reviewed-by: Kevin Wolf <kwolf@redhat.com>
> ---
> python/qemu/machine.py | 30 +++++++++++++++++-------------
> python/qemu/qtest.py | 22 +++++++++++++++++-----
> 2 files changed, 34 insertions(+), 18 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
- Re: [PATCH 06/20] python/machine.py: use qmp.command, (continued)
[PATCH 09/20] python/qemu: make 'args' style arguments immutable, John Snow, 2020/10/06
- Re: [PATCH 09/20] python/qemu: make 'args' style arguments immutable,
Philippe Mathieu-Daudé <=
[PATCH 10/20] iotests.py: Adjust HMP kwargs typing, John Snow, 2020/10/06
[PATCH 11/20] python/qemu: Add mypy type annotations, John Snow, 2020/10/06
[PATCH 12/20] python/qemu/console_socket.py: Correct type of recv(), John Snow, 2020/10/06
[PATCH 13/20] python/qemu/console_socket.py: fix typing of settimeout, John Snow, 2020/10/06
[PATCH 14/20] python/qemu/console_socket.py: Clarify type of drain_thread, John Snow, 2020/10/06