[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 10/16] qapi/expr.py: Remove single-letter variable
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v3 10/16] qapi/expr.py: Remove single-letter variable |
Date: |
Thu, 25 Feb 2021 15:03:37 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Why? Is it to appease a style checker?
I disagree with a blanket ban of single-letter variable names.
If @f is deemed too terrible to live, then I'd prefer @feat over
@feature, because it's more visually distant to @features.
John Snow <jsnow@redhat.com> writes:
> Signed-off-by: John Snow <jsnow@redhat.com>
> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
> Reviewed-by: Cleber Rosa <crosa@redhat.com>
> ---
> scripts/qapi/expr.py | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
> index 3235a3b809e..473ee4f7f7e 100644
> --- a/scripts/qapi/expr.py
> +++ b/scripts/qapi/expr.py
> @@ -214,14 +214,14 @@ def check_features(features: Optional[object],
> raise QAPISemError(info, "'features' must be an array")
> features[:] = [f if isinstance(f, dict) else {'name': f}
> for f in features]
> - for f in features:
> + for feature in features:
> source = "'features' member"
> - assert isinstance(f, dict)
> - check_keys(f, info, source, ['name'], ['if'])
> - check_name_is_str(f['name'], info, source)
> - source = "%s '%s'" % (source, f['name'])
> - check_name_str(f['name'], info, source)
> - check_if(f, info, source)
> + assert isinstance(feature, dict)
> + check_keys(feature, info, source, ['name'], ['if'])
> + check_name_is_str(feature['name'], info, source)
> + source = "%s '%s'" % (source, feature['name'])
> + check_name_str(feature['name'], info, source)
> + check_if(feature, info, source)
>
>
> def check_enum(expr: Expression, info: QAPISourceInfo) -> None:
- Re: [PATCH v3 06/16] qapi/expr.py: Check type of 'data' member, (continued)
[PATCH v3 07/16] qapi/expr.py: Add casts in a few select cases, John Snow, 2021/02/22
[PATCH v3 09/16] qapi/expr.py: Consolidate check_if_str calls in check_if, John Snow, 2021/02/22
[PATCH v3 10/16] qapi/expr.py: Remove single-letter variable, John Snow, 2021/02/22
- Re: [PATCH v3 10/16] qapi/expr.py: Remove single-letter variable,
Markus Armbruster <=
[PATCH v3 11/16] qapi/expr.py: enable pylint checks, John Snow, 2021/02/22
[PATCH v3 12/16] qapi/expr.py: Add docstrings, John Snow, 2021/02/22
[PATCH v3 08/16] qapi/expr.py: add type hint annotations, John Snow, 2021/02/22
Re: [PATCH v3 08/16] qapi/expr.py: add type hint annotations, Markus Armbruster, 2021/02/25
[PATCH v3 13/16] qapi/expr.py: Modify check_keys to accept any Collection, John Snow, 2021/02/22