[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 13/16] qapi/expr.py: Modify check_keys to accept any Iterable
From: |
Eduardo Habkost |
Subject: |
Re: [PATCH 13/16] qapi/expr.py: Modify check_keys to accept any Iterable |
Date: |
Wed, 23 Sep 2020 16:17:43 -0400 |
On Tue, Sep 22, 2020 at 05:13:10PM -0400, John Snow wrote:
> This is a very minor adjustment.
>
> a + b is list-specific behavior, but we can accept a wider variety of
> types in a more pythonic fashion if we avoid that behavior.
>
> Typing it this way allows callers to use things like dict.keys() and
> other iterables that are not their own discrete lists.
>
> Including it just as a statement of practice if nothing else: It's nice
> to use the least-specific type possible as function input and use the
> most-specific type for returns.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
--
Eduardo
- Re: [PATCH 10/16] qapi/expr.py: Remove single-letter variable, (continued)
- [PATCH 11/16] qapi/expr.py: enable pylint checks, John Snow, 2020/09/22
- [PATCH 12/16] qapi/expr.py: Add docstrings, John Snow, 2020/09/22
- [PATCH 13/16] qapi/expr.py: Modify check_keys to accept any Iterable, John Snow, 2020/09/22
- [PATCH 15/16] qapi/expr.py: move related checks inside check_xxx functions, John Snow, 2020/09/22
- [PATCH 14/16] qapi/expr.py: Use tuples instead of lists for static data, John Snow, 2020/09/22
- [PATCH 16/16] qapi/expr.py: Use an expression checker dispatch table, John Snow, 2020/09/22