[Xcb] [PATCH libxcb 07/18] c_client.py: use "foo".join() instead of reduce

Ran Benita ran234 at gmail.com
Sun Oct 12 11:58:09 PDT 2014


Signed-off-by: Ran Benita <ran234 at gmail.com>
---
 src/c_client.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/c_client.py b/src/c_client.py
index 7f768e0..7051e44 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -1,6 +1,5 @@
 #!/usr/bin/env python
 from __future__ import print_function
-from functools import reduce
 import getopt
 import os
 import sys
@@ -846,7 +845,7 @@ def _c_serialize_helper_fields_fixed_size(context, self, field,
         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)]
-        typename = reduce(lambda x,y: "%s.%s" % (x, y), scoped_name)
+        typename = ".".join(scoped_name)
         code_lines.append('%s    /* %s.%s */' % (space, typename, field.c_field_name))
 
     abs_field_name = _c_helper_absolute_name(prefix, field)
@@ -1181,12 +1180,12 @@ def _c_serialize(context, self):
         if self.is_switch:
             # switch: call _unpack()
             _c('    %s _aux;', self.c_type)
-            _c('    return %s(%s, &_aux);', self.c_unpack_name, reduce(lambda x,y: "%s, %s" % (x, y), param_names))
+            _c('    return %s(%s, &_aux);', self.c_unpack_name, ", ".join(param_names))
             _c('}')
             return
         elif self.c_var_followed_by_fixed_fields:
             # special case: call _unserialize()
-            _c('    return %s(%s, NULL);', self.c_unserialize_name, reduce(lambda x,y: "%s, %s" % (x, y), param_names))
+            _c('    return %s(%s, NULL);', self.c_unserialize_name, ", ".join(param_names))
             _c('}')
             return
         else:
@@ -2013,7 +2012,7 @@ def _c_request_helper(self, name, cookie_type, void, regular, aux=False, reply_f
         serialize_args = get_serialize_params(context, type_obj,
                                               c_field_name,
                                               aux_var)[2]
-        return reduce(lambda x,y: "%s, %s" % (x,y), [a[2] for a in serialize_args])
+        return ", ".join(a[2] for a in serialize_args)
 
     # calls in order to free dyn. all. memory
     free_calls = []
-- 
2.1.2



More information about the Xcb mailing list