[Xcb] [PATCH libxcb 10/18] c_client.py: use pattern matching with enumerate()

RĂ©mi Cardona remi at gentoo.org
Sun Oct 12 13:40:09 PDT 2014


Le 12/10/2014 20:58, Ran Benita a écrit :
> @@ -483,8 +483,7 @@ def _c_helper_resolve_field_names (prefix):
>      all_fields = {}
>      tmp_prefix = []
>      # look for fields in the remaining containers
> -    for idx, p in enumerate(prefix):
> -        name, sep, obj = p
> +    for (idx, (name, sep, obj)) in enumerate(prefix):

The outer parenthesis can be dropped.

> @@ -833,7 +832,7 @@ def _c_serialize_helper_fields_fixed_size(context, self, field,
>      if not self.is_case_or_bitcase:
>          code_lines.append('%s    /* %s.%s */' % (space, self.c_type, field.c_field_name))
>      else:
> -        scoped_name = [p[2].c_type if idx==0 else p[0] for idx, p in enumerate(prefix)]
> +        scoped_name = [obj.c_type if idx==0 else name for idx, (name, sep, obj) in enumerate(prefix)]

sep is unused, use _ instead (just like you did in the following chunk).

Patch looks otherwise good.

Rémi


More information about the Xcb mailing list